import {
  IsEnum,
  IsOptional,
  IsDateString,
  IsInt,
  Min,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { CallStatus } from '@prisma/client';

export class UpdateCallStatusDto {
  @ApiProperty({
    description: 'New call status',
    enum: CallStatus,
    example: CallStatus.ANSWERED,
  })
  @IsEnum(CallStatus)
  status: CallStatus;

  @ApiPropertyOptional({
    description: 'Timestamp when the call was answered (ISO 8601)',
    example: '2026-02-17T10:30:00.000Z',
  })
  @IsDateString()
  @IsOptional()
  answeredAt?: string;

  @ApiPropertyOptional({
    description: 'Timestamp when the call ended (ISO 8601)',
    example: '2026-02-17T10:35:00.000Z',
  })
  @IsDateString()
  @IsOptional()
  endedAt?: string;

  @ApiPropertyOptional({
    description: 'Call duration in seconds',
    example: 300,
    minimum: 0,
  })
  @IsInt()
  @Min(0)
  @IsOptional()
  duration?: number;
}
