import { ApiPropertyOptional } from '@nestjs/swagger';
import {
  IsString,
  IsOptional,
  IsDateString,
  IsEnum,
} from 'class-validator';
import { ActionStatus, Priority } from '@prisma/client';

/**
 * DTO for updating an action item
 */
export class UpdateActionDto {
  @ApiPropertyOptional({
    description: 'Action item title',
    example: 'Fix conveyor belt alignment - Updated',
  })
  @IsOptional()
  @IsString()
  title?: string;

  @ApiPropertyOptional({
    description: 'Detailed description of the action',
    example: 'Updated description with more details',
  })
  @IsOptional()
  @IsString()
  description?: string;

  @ApiPropertyOptional({
    description: 'User ID of the assignee',
    example: 'clq1234567890abcdef',
  })
  @IsOptional()
  @IsString()
  assigneeId?: string;

  @ApiPropertyOptional({
    description: 'Due date for the action (YYYY-MM-DD)',
    example: '2024-01-25',
  })
  @IsOptional()
  @IsDateString()
  dueDate?: string;

  @ApiPropertyOptional({
    description: 'Action status',
    enum: ActionStatus,
  })
  @IsOptional()
  @IsEnum(ActionStatus)
  status?: ActionStatus;

  @ApiPropertyOptional({
    description: 'Priority level',
    enum: Priority,
  })
  @IsOptional()
  @IsEnum(Priority)
  priority?: Priority;

  @ApiPropertyOptional({
    description: 'Completion timestamp (ISO 8601)',
    example: '2024-01-18T14:30:00Z',
  })
  @IsOptional()
  @IsDateString()
  completedAt?: string;
}
