import { z } from "zod";
import { TaskStatus } from "@prisma/client";

export const createTaskSchema = z.object({
  name: z.string().trim().min(1, "Required"),
  status: z.nativeEnum(TaskStatus, { required_error: "Required" }),
  workspaceId: z.string().trim().min(1, "Required"),
  projectId: z.string().trim().min(1, "Required"),
  assigneeId: z.string().trim().min(1, "Required"),
  boardId: z.string().optional(),
  epicId: z.string().optional(),
  description: z.string().optional(),
  dueDate: z.coerce.date(),
  labels: z.array(z.string()).optional().default([]),
  attachments: z.array(z.string()).optional().default([]),
});

export const updateTaskSchema = z.object({
  name: z.string().trim().min(1, "Required").optional(),
  status: z.nativeEnum(TaskStatus).optional(),
  assigneeId: z.string().trim().min(1, "Required").optional(),
  projectId: z.string().trim().min(1, "Required").optional(),
  boardId: z.string().optional(),
  epicId: z.string().optional(),
  description: z.string().optional(),
  dueDate: z.coerce.date().optional(),
  labels: z.array(z.string()).optional(),
  attachments: z.array(z.string()).optional(),
});
