import { IsString, IsOptional, IsBoolean, IsArray, ValidateNested, IsNumber, IsEnum } from 'class-validator'
import { Type } from 'class-transformer'

export class WorkflowStepDefDto {
  @IsString() stepId: string
  @IsNumber() order: number
  @IsString() title: string
  @IsOptional() @IsString() description?: string
  @IsBoolean() mandatory: boolean
  @IsOptional() @IsString() linkedFormTemplateId?: string
  @IsOptional() @IsNumber() deadlineDays?: number
  @IsOptional() @IsString() dueAfterStepId?: string
}

export class CreateWorkflowTemplateDto {
  @IsString() name: string
  @IsOptional() @IsString() description?: string

  @IsOptional()
  @IsEnum(['immigration','corporate','civil_litigation','property','family','employment','criminal','other','universal'])
  practiceArea?: string

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => WorkflowStepDefDto)
  steps: WorkflowStepDefDto[]

  @IsOptional() @IsBoolean() isActive?: boolean
  @IsOptional() @IsString() notes?: string
}
