import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsDateString, IsIn, IsOptional, IsString } from 'class-validator';

export const IMPORT_DJIBOUTI_DOCUMENT_TYPES = [
  'GATE_PASS',
  'DELIVERY_ORDER',
  'PORT_INVOICE',
  'DJIBOUTI_T1',
  'ETHIOPIA_T1',
  'RAILWAY_BILL',
] as const;

export type ImportDjiboutiDocumentType = (typeof IMPORT_DJIBOUTI_DOCUMENT_TYPES)[number];

export class UploadImportDjiboutiDocumentDto {
  @ApiProperty({ enum: IMPORT_DJIBOUTI_DOCUMENT_TYPES })
  @IsIn(IMPORT_DJIBOUTI_DOCUMENT_TYPES)
  documentType!: ImportDjiboutiDocumentType;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  fileId?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  fileUrl?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  reference?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  notes?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  performedBy?: string;
}

export class ImportDjiboutiActionDto {
  @ApiPropertyOptional({ description: 'Gate pass secured date/time. Defaults to now.' })
  @IsOptional()
  @IsDateString()
  securedAt?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  fileId?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  fileUrl?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  reference?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  performedBy?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  notes?: string;
}
