import { IsNumber, IsOptional, IsString, MaxLength, MinLength } from "class-validator";

/**
 * DTO for a single jarvis-brain project record.
 * This matches the project object shape consumed by scripts/migrate-brain.ts.
 */
export class ImportProjectDto {
  @IsString({ message: "id must be a string" })
  @MinLength(1, { message: "id must not be empty" })
  @MaxLength(255, { message: "id must not exceed 255 characters" })
  id!: string;

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

  @IsOptional()
  @IsString({ message: "description must be a string" })
  description?: string | null;

  @IsOptional()
  @IsString({ message: "domain must be a string" })
  domain?: string | null;

  @IsOptional()
  @IsString({ message: "status must be a string" })
  status?: string | null;

  // jarvis-brain project priority can be a number, string, or null
  @IsOptional()
  priority?: number | string | null;

  @IsOptional()
  @IsNumber({}, { message: "progress must be a number" })
  progress?: number | null;

  @IsOptional()
  @IsString({ message: "repo must be a string" })
  repo?: string | null;

  @IsOptional()
  @IsString({ message: "branch must be a string" })
  branch?: string | null;

  @IsOptional()
  @IsString({ message: "current_milestone must be a string" })
  current_milestone?: string | null;

  @IsOptional()
  @IsString({ message: "next_milestone must be a string" })
  next_milestone?: string | null;

  @IsOptional()
  @IsString({ message: "blocker must be a string" })
  blocker?: string | null;

  @IsOptional()
  @IsString({ message: "owner must be a string" })
  owner?: string | null;

  @IsOptional()
  @IsString({ message: "docs_path must be a string" })
  docs_path?: string | null;

  @IsOptional()
  @IsString({ message: "created must be a string" })
  created?: string | null;

  @IsOptional()
  @IsString({ message: "updated must be a string" })
  updated?: string | null;

  @IsOptional()
  @IsString({ message: "target_date must be a string" })
  target_date?: string | null;

  @IsOptional()
  @IsString({ message: "notes must be a string" })
  notes?: string | null;

  @IsOptional()
  @IsString({ message: "notes_nontechnical must be a string" })
  notes_nontechnical?: string | null;

  @IsOptional()
  @IsString({ message: "parent must be a string" })
  parent?: string | null;
}
