export type InterchangeDirection = 'IMPORT' | 'EXPORT';
export type InterchangeDocumentStatus =
  | 'DRAFT'
  | 'GENERATED'
  | 'ACKNOWLEDGED'
  | 'DISPUTED'
  | 'CANCELLED';
export type InterchangeItemType = 'CONTAINER' | 'CARGO';
export type InterchangeConditionStatus =
  | 'GOOD'
  | 'DAMAGED'
  | 'SHORTAGE'
  | 'EXCESS'
  | 'HOLD'
  | 'UNKNOWN';

export interface InterchangeDocumentItem {
  id: string;
  interchangeDocumentId: string;
  bookingId: string | null;
  bookingReference: string | null;
  itemType: InterchangeItemType;
  bookingContainerId: string | null;
  bookingCargoId: string | null;
  containerNumber: string | null;
  sealNumber: string | null;
  cargoId: string | null;
  cargoType: string | null;
  cargoDescription: string | null;
  weight: number | null;
  quantity: number | null;
  packageCount: number | null;
  wagonNumber: string | null;
  conditionStatus: InterchangeConditionStatus;
  damageDescription: string | null;
  remarks: string | null;
}

export interface InterchangeDocument {
  id: string;
  documentNo: string;
  direction: InterchangeDirection;
  scheduleId: string | null;
  trainNo: string | null;
  routeId: string | null;
  originFacilityId: string | null;
  destinationFacilityId: string | null;
  handoverLocation: string;
  handoverFrom: string;
  handoverTo: string;
  operatorName: string | null;
  portOperatorName: string | null;
  shippingLineName: string | null;
  customsReference: string | null;
  manifestReference: string | null;
  status: InterchangeDocumentStatus;
  generatedAt: string | null;
  acknowledgedAt: string | null;
  generatedBy: string | null;
  acknowledgedBy: string | null;
  remarks: string | null;
  createdAt: string;
  updatedAt: string;
  items?: InterchangeDocumentItem[];
}

export interface InterchangeDocumentFilter {
  direction?: InterchangeDirection;
  status?: InterchangeDocumentStatus;
  scheduleId?: string;
  documentNo?: string;
  dateFrom?: string;
  dateTo?: string;
  search?: string;
}

export interface GenerateInterchangeDocumentPayload {
  scheduleId: string;
  direction: InterchangeDirection;
  handoverLocation: string;
  handoverFrom: string;
  handoverTo: string;
  operatorName?: string;
  portOperatorName?: string;
  shippingLineName?: string;
  customsReference?: string;
  manifestReference?: string;
  generatedBy?: string;
  remarks?: string;
}
