import { AllocationStatus, UpdateAllocationHoursSchema } from "@capakraken/shared";
import { z } from "zod";

export { UpdateAllocationHoursSchema };

export const timelineQuickAssignInputSchema = z.object({
  resourceId: z.string(),
  projectId: z.string(),
  startDate: z.coerce.date(),
  endDate: z.coerce.date(),
  hoursPerDay: z.number().min(0.5).max(24).default(8),
  role: z.string().min(1).max(200).default("Team Member"),
  roleId: z.string().optional(),
  status: z.nativeEnum(AllocationStatus).default(AllocationStatus.PROPOSED),
});

export const timelineBatchQuickAssignInputSchema = z.object({
  assignments: z
    .array(
      z.object({
        resourceId: z.string(),
        projectId: z.string(),
        startDate: z.coerce.date(),
        endDate: z.coerce.date(),
        hoursPerDay: z.number().min(0.5).max(24).default(8),
        role: z.string().min(1).max(200).default("Team Member"),
        status: z.nativeEnum(AllocationStatus).default(AllocationStatus.PROPOSED),
      }),
    )
    .min(1)
    .max(50),
});

export const timelineBatchShiftAllocationsInputSchema = z.object({
  allocationIds: z.array(z.string()).min(1).max(100),
  daysDelta: z.number().int().min(-3650).max(3650),
  mode: z.enum(["move", "resize-start", "resize-end"]).default("move"),
});

export const timelineCarveAllocationRangeInputSchema = z.object({
  allocationId: z.string(),
  startDate: z.coerce.date(),
  endDate: z.coerce.date(),
});

export const timelineExtractAllocationFragmentInputSchema = z.object({
  allocationId: z.string(),
  startDate: z.coerce.date(),
  endDate: z.coerce.date(),
});
