import { IdeaStatus, TaskPriority } from "@prisma/client";
import {
  IsString,
  IsOptional,
  IsEnum,
  IsArray,
  IsUUID,
  IsObject,
  MinLength,
  MaxLength,
} from "class-validator";

/**
 * DTO for creating a new idea
 */
export class CreateIdeaDto {
  @IsOptional()
  @IsString({ message: "title must be a string" })
  @MaxLength(500, { message: "title must not exceed 500 characters" })
  title?: string;

  @IsString({ message: "content must be a string" })
  @MinLength(1, { message: "content must not be empty" })
  @MaxLength(50000, { message: "content must not exceed 50000 characters" })
  content!: string;

  @IsOptional()
  @IsUUID("4", { message: "domainId must be a valid UUID" })
  domainId?: string;

  @IsOptional()
  @IsUUID("4", { message: "projectId must be a valid UUID" })
  projectId?: string;

  @IsOptional()
  @IsEnum(IdeaStatus, { message: "status must be a valid IdeaStatus" })
  status?: IdeaStatus;

  @IsOptional()
  @IsEnum(TaskPriority, { message: "priority must be a valid TaskPriority" })
  priority?: TaskPriority;

  @IsOptional()
  @IsString({ message: "category must be a string" })
  @MaxLength(100, { message: "category must not exceed 100 characters" })
  category?: string;

  @IsOptional()
  @IsArray({ message: "tags must be an array" })
  @IsString({ each: true, message: "each tag must be a string" })
  tags?: string[];

  @IsOptional()
  @IsObject({ message: "metadata must be an object" })
  metadata?: Record<string, unknown>;
}
