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