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

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

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