import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsString, IsNotEmpty, IsOptional, IsUUID, IsEnum, IsDateString } from 'class-validator';
import { CrmActivityType, CrmActivityPriority, CrmMessageChannel } from '@prisma/client';

export class CreateActivityDto {
  @ApiPropertyOptional({ description: 'Deal ID' })
  @IsUUID()
  @IsOptional()
  dealId?: string;

  @ApiProperty({ enum: CrmActivityType, default: 'CALL' })
  @IsEnum(CrmActivityType)
  type: CrmActivityType;

  @ApiProperty({ description: 'Subject', example: 'Позвонить клиенту' })
  @IsString()
  @IsNotEmpty()
  subject: string;

  @ApiPropertyOptional()
  @IsString()
  @IsOptional()
  description?: string;

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

  @ApiPropertyOptional()
  @IsDateString()
  @IsOptional()
  deadline?: string;

  @ApiPropertyOptional({ enum: CrmActivityPriority, default: 'MEDIUM' })
  @IsEnum(CrmActivityPriority)
  @IsOptional()
  priority?: CrmActivityPriority;

  @ApiPropertyOptional({ enum: CrmMessageChannel })
  @IsEnum(CrmMessageChannel)
  @IsOptional()
  channel?: CrmMessageChannel;
}
