import {
  IsString,
  IsInt,
  IsNotEmpty,
  MaxLength,
  IsDateString,
  IsBoolean,
  IsOptional,
  Min,
  Max,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateDateIvtDto {
  @ApiProperty({
    description: 'Questionnaire ID',
    example: 1,
  })
  @IsInt()
  @IsNotEmpty()
  questionnaire_id: number;

  @ApiProperty({
    description: 'Phone number of the user',
    maxLength: 50,
    example: '+33123456789',
  })
  @IsString()
  @IsNotEmpty()
  @MaxLength(50)
  phone_number: string;

  @ApiProperty({
    description: 'First name of the user',
    maxLength: 100,
    example: 'John',
  })
  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  first_name: string;

  @ApiProperty({
    description: 'Next injection date',
    example: '2024-12-31',
  })
  @IsDateString()
  @IsNotEmpty()
  next_injection_date: string;

  @ApiPropertyOptional({
    description: 'Whether the user attended the injection',
    example: true,
  })
  @IsBoolean()
  @IsOptional()
  attentedInjection?: boolean;

  @ApiPropertyOptional({
    description: 'Injection experience rating (1 to 5)',
    example: 4,
    minimum: 1,
    maximum: 5,
  })
  @IsInt()
  @Min(1)
  @Max(5)
  @IsOptional()
  injectionExperience?: number;

  @ApiPropertyOptional({
    description: 'Reason for absence if injection was not attended',
    example: 'Maladie',
  })
  @IsString()
  @IsOptional()
  absenceReason?: string;
}
