| 1 | import { |
| 2 | IsEnum, |
| 3 | IsOptional, |
| 4 | IsString, |
| 5 | MaxLength, |
| 6 | ValidateIf, |
| 7 | } from 'class-validator'; |
| 8 | |
| 9 | import { ApiPropertyOptional } |
| 10 | import { |
| 11 | BookingReason, |
| 12 | SeatType, |
| 13 | SeatingClass, |
| 14 | } from '@prisma/client'; |
| 15 | |
| 16 | export class UpdateFlightBookingDTO |
| 17 | @ApiPropertyOptional({ |
| 18 | description: 'Booking code/confirmation code (e.g., "ABC123"). Set to null to clear.', |
| 19 | example: 'ABC123', |
| 20 | maxLength: 50, |
| 21 | nullable: true, |
| 22 | }) |
| 23 | @ValidateIf((o |
| 24 | @IsString() |
| 25 | @IsOptional() |
| 26 | @MaxLength(50) |
| 27 | bookingCode?: string |
| 28 | |
| 29 | @ApiPropertyOptional({ |
| 30 | description: 'Seat number (e.g., "12A", "1F"). Set to null to clear.', |
| 31 | example: '12A', |
| 32 | maxLength: 10, |
| 33 | nullable: true, |
| 34 | }) |
| 35 | @ValidateIf((o |
| 36 | @IsString() |
| 37 | @IsOptional() |
| 38 | @MaxLength(10) |
| 39 | seatNumber?: string |
| 40 | |
| 41 | @ApiPropertyOptional({ |
| 42 | description: 'Type of seat position. Set to null to clear.', |
| 43 | enum: SeatType, |
| 44 | example: SeatType.window |
| 45 | nullable: true, |
| 46 | }) |
| 47 | @ValidateIf((o |
| 48 | @IsEnum(SeatType) |
| 49 | @IsOptional() |
| 50 | seatType?: SeatType |
| 51 | |
| 52 | @ApiPropertyOptional({ |
| 53 | description: 'Class of service. Set to null to clear.', |
| 54 | enum: SeatingClass, |
| 55 | example: SeatingClass.economy |
| 56 | nullable: true, |
| 57 | }) |
| 58 | @ValidateIf((o |
| 59 | @IsEnum(SeatingClass) |
| 60 | @IsOptional() |
| 61 | seatingClass?: SeatingClass |
| 62 | |
| 63 | @ApiPropertyOptional({ |
| 64 | description: 'Reason for the flight. Set to null to clear.', |
| 65 | enum: BookingReason, |
| 66 | example: BookingReason.personal |
| 67 | nullable: true, |
| 68 | }) |
| 69 | @ValidateIf((o |
| 70 | @IsEnum(BookingReason) |
| 71 | @IsOptional() |
| 72 | reason?: BookingReason |
| 73 | |
| 74 | @ApiPropertyOptional({ |
| 75 | description: 'Additional notes about the booking. Set to null to clear.', |
| 76 | example: 'Window seat preferred', |
| 77 | maxLength: 500, |
| 78 | nullable: true, |
| 79 | }) |
| 80 | @ValidateIf((o |
| 81 | @IsString() |
| 82 | @IsOptional() |
| 83 | @MaxLength(500) |
| 84 | notes?: string |
| 85 | } |
| 86 | |