import { z } from "zod";

export const AbsenceTriggerEnum = z.enum(["SICK", "VACATION", "PUBLIC_HOLIDAY", "CUSTOM"]);
export const CostEffectEnum = z.enum(["CHARGE", "ZERO", "REDUCE"]);
export const ChargeabilityEffectEnum = z.enum(["COUNT", "SKIP"]);

export const CreateCalculationRuleSchema = z.object({
  name: z.string().min(1).max(200),
  description: z.string().max(1000).optional(),
  triggerType: AbsenceTriggerEnum,
  projectId: z.string().optional(),
  orderType: z.string().optional(),
  costEffect: CostEffectEnum,
  costReductionPercent: z.number().int().min(0).max(100).optional(),
  chargeabilityEffect: ChargeabilityEffectEnum,
  priority: z.number().int().min(0).max(1000).default(0),
  isActive: z.boolean().default(true),
});

export const UpdateCalculationRuleSchema = CreateCalculationRuleSchema.partial().extend({
  id: z.string(),
});
