import { ApiProperty } from '@nestjs/swagger';
import { StatutUtilisateurType } from 'src/entities/users.entity';
import { StatutEnfantType, GenreType } from 'src/entities/children.entity';

/** Parent dans le dossier famille (infos utilisateur + parent) */
export class DossierFamilleParentDto {
  @ApiProperty()
  user_id: string;
  @ApiProperty()
  email: string;
  @ApiProperty({ required: false })
  prenom?: string;
  @ApiProperty({ required: false })
  nom?: string;
  @ApiProperty({ required: false })
  telephone?: string;
  @ApiProperty({ required: false })
  adresse?: string;
  @ApiProperty({ required: false })
  ville?: string;
  @ApiProperty({ required: false })
  code_postal?: string;
  @ApiProperty({ enum: StatutUtilisateurType })
  statut: StatutUtilisateurType;
  @ApiProperty({ required: false, description: 'Id du co-parent si couple' })
  co_parent_id?: string;
}

/** Enfant dans le dossier famille */
export class DossierFamilleEnfantDto {
  @ApiProperty()
  id: string;
  @ApiProperty({ required: false })
  first_name?: string;
  @ApiProperty({ required: false })
  last_name?: string;
  @ApiProperty({ required: false, enum: GenreType })
  genre?: GenreType;
  @ApiProperty({ required: false })
  birth_date?: Date;
  @ApiProperty({ required: false })
  due_date?: Date;
  @ApiProperty({ enum: StatutEnfantType })
  status: StatutEnfantType;

  @ApiProperty({
    required: false,
    description: 'Chemin ou URL de la photo (souvent relatif, ex. /uploads/photos/...)',
  })
  photo_url?: string;

  @ApiProperty({
    required: false,
    description: 'Consentement affichage photo (colonne consentement_photo)',
  })
  consent_photo?: boolean;

  @ApiProperty({ required: false, description: 'Grossesse multiple (est_multiple)' })
  est_multiple?: boolean;
}

/** Réponse GET /parents/dossier-famille/:numeroDossier – dossier famille complet. Ticket #119 */
export class DossierFamilleCompletDto {
  @ApiProperty({ example: '2026-000001', description: 'Numéro de dossier famille' })
  numero_dossier: string;
  @ApiProperty({ type: [DossierFamilleParentDto] })
  parents: DossierFamilleParentDto[];
  @ApiProperty({ type: [DossierFamilleEnfantDto], description: 'Enfants de la famille' })
  enfants: DossierFamilleEnfantDto[];
  @ApiProperty({ required: false, description: 'Texte de présentation / motivation (un seul par famille)' })
  texte_motivation?: string;
}
