import { objectId } from '@jig-software/zod-bson';
import { z } from 'zod';
import { LeaveType } from './LeaveType';

export const LeaveCapRule = z.object({
  _id: objectId(),
  type: LeaveType,
  applyingTo: z.array(objectId()).nullable(), // `null` means ALL staffs.
  monthlyCaps: z.array(z.number()).length(12),
  lastAppliedAt: z.date(),
  createdAt: z.date(),
  updatedAt: z.date(),
});

export type LeaveCapRule = z.infer<typeof LeaveCapRule>;
