import { IsNotEmpty, IsString, IsDate, IsNumber, IsOptional } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';

export class CreateAppointmentDto {
  @ApiPropertyOptional({ description: 'Full name', example: 'John Doe' })
  @IsString()
  @IsOptional()
  fullName?: string;

  @ApiProperty({ description: 'Title of the appointment', example: 'Cyber consultation' })
  @IsNotEmpty()
  @IsString()
  title: string;

  @ApiPropertyOptional({ description: 'Additional notes about the appointment', example: ' Facebook id hack' })
  @IsOptional()
  @IsString()
  notes?: string;

  @ApiProperty({ description: 'Date of the appointment', example: '2024-02-25T10:00:00.000Z' })
  @IsNotEmpty()
  @IsDate()
  @Type(() => Date)
  appointmentDate: Date;

  @ApiProperty({ description: 'Time of the appointment (HH:mm format)', example: '14:30' })
  @IsNotEmpty()
  @IsString()
  appointmentTime: string;

  @ApiProperty({ description: 'Duration of the appointment in minutes', example: 30 })
  @IsNotEmpty()
  @IsNumber()
  duration: number;

  @ApiPropertyOptional({ description: 'Phone number', example: 1234567890 })
  @IsOptional()
  @IsNumber()
  phone?: number;

  @ApiPropertyOptional({ description: 'User ID', example: 1 })
  @IsOptional()
  @IsNumber()
  userId?: number;
}
