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

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

  @ApiPropertyOptional({
    description: 'Partial questionnaire data as JSON object',
    example: { step1: 'value1', step2: 'value2' },
  })
  @IsObject()
  @IsOptional()
  data?: Record<string, any>;

  @ApiPropertyOptional({
    description: 'Current step in the questionnaire (1-9)',
    minimum: 1,
    maximum: 9,
    default: 1,
  })
  @IsInt()
  @IsOptional()
  @Min(1)
  @Max(9)
  current_step?: number;

  @ApiPropertyOptional({
    description: 'Whether the questionnaire is completed',
    default: false,
  })
  @IsBoolean()
  @IsOptional()
  is_completed?: boolean;

  @ApiPropertyOptional({
    description: 'Center name',
    maxLength: 150,
  })
  @IsString()
  @IsOptional()
  @MaxLength(150)
  center?: string;
}
