import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
  IsString,
  IsNotEmpty,
  IsOptional,
  IsUUID,
  IsEnum,
  IsDateString,
  IsInt,
  Min,
  Max,
} from 'class-validator';
import { CrmTrainingType } from '@prisma/client';

export class CreateCrmTrainingDto {
  @ApiProperty({ description: 'Deal ID' })
  @IsUUID()
  dealId: string;

  @ApiPropertyOptional({ description: 'Trainer user ID' })
  @IsUUID()
  @IsOptional()
  trainerId?: string;

  @ApiProperty({ description: 'Client name' })
  @IsString()
  @IsNotEmpty()
  clientName: string;

  @ApiPropertyOptional({ enum: CrmTrainingType, default: 'PERSONAL' })
  @IsEnum(CrmTrainingType)
  @IsOptional()
  type?: CrmTrainingType;

  @ApiProperty({ description: 'Scheduled date/time (ISO 8601)' })
  @IsDateString()
  scheduledAt: string;

  @ApiPropertyOptional({ description: 'Duration in minutes', default: 60 })
  @IsInt()
  @Min(15)
  @Max(480)
  @IsOptional()
  duration?: number;

  @ApiPropertyOptional()
  @IsString()
  @IsOptional()
  notes?: string;
}
