import type { BaseEntity } from "../common";

export enum BookingStatus {
  Draft = "DRAFT",
  Confirmed = "CONFIRMED",
  InTransit = "IN_TRANSIT",
  Delivered = "DELIVERED",
  Cancelled = "CANCELLED",
}

export enum ConsignmentStatus {
  Pending = "PENDING",
  Loaded = "LOADED",
  InTransit = "IN_TRANSIT",
  AtDestination = "AT_DESTINATION",
  Delivered = "DELIVERED",
  Returned = "RETURNED",
}

export enum TrainStatus {
  Available = "AVAILABLE",
  Scheduled = "SCHEDULED",
  InService = "IN_SERVICE",
  UnderMaintenance = "UNDER_MAINTENANCE",
  OutOfService = "OUT_OF_SERVICE",
}

export enum CargoType {
  Container = "CONTAINER",
  BulkLiquid = "BULK_LIQUID",
  BulkDry = "BULK_DRY",
  General = "GENERAL",
  Refrigerated = "REFRIGERATED",
  Hazardous = "HAZARDOUS",
}

export enum PaymentStatus {
  Pending = "PENDING",
  Paid = "PAID",
  Overdue = "OVERDUE",
  Cancelled = "CANCELLED",
  Refunded = "REFUNDED",
}

export interface ICustomer extends BaseEntity {
  name: string;
  email: string;
  phone: string;
  address?: string;
  taxId?: string;
}

export interface ITrain extends BaseEntity {
  code: string;
  capacityTons: number;
  status: TrainStatus;
  notes?: string;
}

export interface ITrackingEvent extends BaseEntity {
  consignmentId: string;
  location: string;
  status: ConsignmentStatus;
  occurredAt: string;
  description?: string;
}

export interface IConsignment extends BaseEntity {
  bookingId: string;
  trackingNumber: string;
  cargoType: CargoType;
  weightKg: number;
  status: ConsignmentStatus;
  originStation: string;
  destinationStation: string;
}

export interface IBooking extends BaseEntity {
  reference: string;
  customerId: string;
  trainId?: string;
  status: BookingStatus;
  scheduledDate: string;
  totalAmount: number;
  paymentStatus: PaymentStatus;
}

export interface IInvoice extends BaseEntity {
  bookingId: string;
  invoiceNumber: string;
  amount: number;
  currency: string;
  status: PaymentStatus;
  issuedAt: string;
  dueAt: string;
}
