import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsDateString, IsEnum, IsOptional, IsString, IsUUID, MaxLength, MinLength, } from 'class-validator'; import { StatutEvenementAgendaType, TypeEvenementAgendaType, } from 'src/entities/evenements_agenda.entity'; export class CreerEvenementAgendaDto { @ApiProperty({ description: 'Placement AM↔enfant (couple)' }) @IsUUID() id_placement: string; @ApiProperty({ enum: TypeEvenementAgendaType }) @IsEnum(TypeEvenementAgendaType) type: TypeEvenementAgendaType; @ApiProperty({ example: '2026-10-01' }) @IsDateString() date_debut: string; @ApiProperty({ example: '2026-10-05' }) @IsDateString() date_fin: string; @ApiPropertyOptional() @IsOptional() @IsString() @MaxLength(2000) motif?: string; } export class MajEvenementAgendaDto { @ApiPropertyOptional({ example: '2026-10-02' }) @IsOptional() @IsDateString() date_debut?: string; @ApiPropertyOptional({ example: '2026-10-06' }) @IsOptional() @IsDateString() date_fin?: string; @ApiPropertyOptional({ enum: StatutEvenementAgendaType }) @IsOptional() @IsEnum(StatutEvenementAgendaType) statut?: StatutEvenementAgendaType; @ApiPropertyOptional({ description: 'Motivation de refus (parent) ou motif créateur', }) @IsOptional() @IsString() @MinLength(1) @MaxLength(2000) motif?: string; } export class EvenementAgendaDto { @ApiProperty() id: string; @ApiProperty() id_placement: string; @ApiProperty({ enum: TypeEvenementAgendaType }) type: TypeEvenementAgendaType; @ApiProperty() date_debut: string; @ApiProperty() date_fin: string; @ApiProperty({ enum: StatutEvenementAgendaType }) statut: StatutEvenementAgendaType; @ApiProperty() expire_at: string; @ApiPropertyOptional() cree_par?: string | null; @ApiPropertyOptional() motif?: string | null; @ApiPropertyOptional() id_enfant?: string | null; @ApiPropertyOptional() prenom_enfant?: string | null; @ApiPropertyOptional() id_am?: string | null; @ApiPropertyOptional() prenom_am?: string | null; @ApiPropertyOptional() nom_am?: string | null; @ApiProperty() cree_le: string; @ApiProperty() modifie_le: string; } export class ListeEvenementsAgendaDto { @ApiProperty({ type: [EvenementAgendaDto] }) items: EvenementAgendaDto[]; }