import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsNotEmpty, IsString } from 'class-validator'; /** * DTO for verifying document access password */ export class VerifyDocumentAccessDto { @ApiProperty({ description: 'Password for document access (booking number code)' }) @IsString() @IsNotEmpty() password: string; } /** * Response DTO for checking document access requirements */ export class DocumentAccessRequirementsDto { @ApiProperty({ description: 'Whether password is required to access documents' }) requiresPassword: boolean; @ApiPropertyOptional({ description: 'Booking number (if available)' }) bookingNumber?: string; @ApiProperty({ description: 'Current booking status' }) status: string; } /** * Booking Summary DTO for Carrier Documents Page */ export class BookingSummaryDto { @ApiProperty({ description: 'Booking unique ID' }) id: string; @ApiPropertyOptional({ description: 'Human-readable booking number' }) bookingNumber?: string; @ApiProperty({ description: 'Carrier/Company name' }) carrierName: string; @ApiProperty({ description: 'Origin port code' }) origin: string; @ApiProperty({ description: 'Destination port code' }) destination: string; @ApiProperty({ description: 'Route description (origin -> destination)' }) routeDescription: string; @ApiProperty({ description: 'Volume in CBM' }) volumeCBM: number; @ApiProperty({ description: 'Weight in KG' }) weightKG: number; @ApiProperty({ description: 'Number of pallets' }) palletCount: number; @ApiProperty({ description: 'Price in the primary currency' }) price: number; @ApiProperty({ description: 'Currency (USD or EUR)' }) currency: string; @ApiProperty({ description: 'Transit time in days' }) transitDays: number; @ApiProperty({ description: 'Container type' }) containerType: string; @ApiProperty({ description: 'When the booking was accepted' }) acceptedAt: Date; } /** * Document with signed download URL for carrier access */ export class DocumentWithUrlDto { @ApiProperty({ description: 'Document unique ID' }) id: string; @ApiProperty({ description: 'Document type', enum: [ 'BILL_OF_LADING', 'PACKING_LIST', 'COMMERCIAL_INVOICE', 'CERTIFICATE_OF_ORIGIN', 'OTHER', ], }) type: string; @ApiProperty({ description: 'Original file name' }) fileName: string; @ApiProperty({ description: 'File MIME type' }) mimeType: string; @ApiProperty({ description: 'File size in bytes' }) size: number; @ApiProperty({ description: 'Temporary signed download URL (valid for 1 hour)' }) downloadUrl: string; } /** * Carrier Documents Response DTO * * Response for carrier document access page */ export class CarrierDocumentsResponseDto { @ApiProperty({ description: 'Booking summary information', type: BookingSummaryDto }) booking: BookingSummaryDto; @ApiProperty({ description: 'List of documents with download URLs', type: [DocumentWithUrlDto] }) documents: DocumentWithUrlDto[]; }