mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-04 09:03:47 +00:00
57 lines
3.0 KiB
TypeScript
57 lines
3.0 KiB
TypeScript
import { IsString, IsDateString, IsInt, IsOptional, Min, IsEnum } from 'class-validator';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { Currency } from '@prisma/client';
|
|
|
|
export class SearchTripsDto {
|
|
@ApiProperty({ example: 'station-uuid', description: 'Origin station UUID — any intermediate stop is valid, not just the terminal' })
|
|
@IsString() originStationId: string;
|
|
|
|
@ApiProperty({ example: 'station-uuid', description: 'Destination station UUID — must appear after origin in the stop sequence' })
|
|
@IsString() destinationStationId: string;
|
|
|
|
@ApiProperty({ example: '2026-06-15', description: 'Departure date (YYYY-MM-DD)' })
|
|
@IsDateString() date: string;
|
|
|
|
@ApiProperty({ example: 2, description: 'Number of adult passengers (age ≥5 years) - pay 100% of base fare' })
|
|
@Type(() => Number) @IsInt() @Min(1) adultCount: number;
|
|
|
|
@ApiPropertyOptional({ example: 1, description: 'Number of child passengers (age <5 years). First child travels FREE, subsequent children pay 100%.' })
|
|
@IsOptional() @Type(() => Number) @IsInt() @Min(0) childCount?: number;
|
|
|
|
@ApiPropertyOptional({ example: 'Ethiopian', description: 'Passenger nationality: Ethiopian (Verifayda verification), Djiboutian (Waafi payment), Other (international payments)' })
|
|
@IsOptional() @IsString() nationality?: string;
|
|
}
|
|
|
|
export class FareQuoteDto {
|
|
@ApiProperty({ example: 'schedule-uuid', description: 'TrainSchedule UUID from search results' })
|
|
@IsString() scheduleId: string;
|
|
|
|
@ApiProperty({ example: 'station-uuid', description: 'Origin station UUID (must be a stop on the schedule)' })
|
|
@IsString() originStationId: string;
|
|
|
|
@ApiProperty({ example: 'station-uuid', description: 'Destination station UUID (must come after origin in stop sequence)' })
|
|
@IsString() destinationStationId: string;
|
|
|
|
@ApiProperty({ example: 'Economy Regular', description: 'Seat class name: "Economy Regular" | "Economy Bed" | "VIP Bed"' })
|
|
@IsString() seatClassName: string;
|
|
|
|
@ApiProperty({ example: 2, description: 'Number of adult passengers (≥5 years) - each pays 100% of base fare' })
|
|
@Type(() => Number) @IsInt() @Min(1) adultCount: number;
|
|
|
|
@ApiPropertyOptional({ example: 1, description: 'Number of child passengers (<5 years) - first child FREE, subsequent children 100%' })
|
|
@IsOptional() @Type(() => Number) @IsInt() @Min(0) childCount?: number;
|
|
|
|
@ApiPropertyOptional({ example: 'WEEKEND15' })
|
|
@IsOptional() @IsString() promoCode?: string;
|
|
|
|
@ApiPropertyOptional({ example: 450, description: 'Loyalty points to redeem (10 points = 1 ETB minor unit)' })
|
|
@IsOptional() @Type(() => Number) @IsInt() loyaltyRedemptionPoints?: number;
|
|
|
|
@ApiPropertyOptional({ example: 'USD', enum: Currency, description: 'Display currency: ETB (default), DJF, USD. Transaction always in ETB.' })
|
|
@IsOptional() @IsEnum(Currency) displayCurrency?: Currency;
|
|
|
|
@ApiPropertyOptional({ example: 'Ethiopian', description: 'Passenger nationality for payment method filtering' })
|
|
@IsOptional() @IsString() nationality?: string;
|
|
}
|