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

export enum TicketStatus {
  Reserved = "RESERVED",
  Confirmed = "CONFIRMED",
  CheckedIn = "CHECKED_IN",
  Cancelled = "CANCELLED",
  Refunded = "REFUNDED",
  Expired = "EXPIRED",
}

export enum SeatClass {
  Economy = "ECONOMY",
  Business = "BUSINESS",
  First = "FIRST",
  Sleeper = "SLEEPER",
}

export enum SeatStatus {
  Available = "AVAILABLE",
  Reserved = "RESERVED",
  Occupied = "OCCUPIED",
  Blocked = "BLOCKED",
}

export enum ScheduleStatus {
  Scheduled = "SCHEDULED",
  Boarding = "BOARDING",
  Departed = "DEPARTED",
  Arrived = "ARRIVED",
  Cancelled = "CANCELLED",
  Delayed = "DELAYED",
}

export enum PaymentStatus {
  Pending = "PENDING",
  Paid = "PAID",
  Failed = "FAILED",
  Refunded = "REFUNDED",
}

export interface IStation extends BaseEntity {
  code: string;
  name: string;
  city: string;
  country: string;
  latitude?: number;
  longitude?: number;
}

export interface ISchedule extends BaseEntity {
  trainCode: string;
  originStationId: string;
  destinationStationId: string;
  departureTime: string;
  arrivalTime: string;
  status: ScheduleStatus;
  basePrice: number;
}

export interface ISeat extends BaseEntity {
  scheduleId: string;
  seatNumber: string;
  seatClass: SeatClass;
  status: SeatStatus;
  price: number;
}

export interface IPassenger extends BaseEntity {
  fullName: string;
  email: string;
  phone: string;
  nationalId?: string;
  dateOfBirth?: string;
}

export interface ITicket extends BaseEntity {
  reference: string;
  passengerId: string;
  scheduleId: string;
  seatId: string;
  status: TicketStatus;
  pricePaid: number;
  issuedAt: string;
}

export interface IPayment extends BaseEntity {
  ticketId: string;
  amount: number;
  currency: string;
  status: PaymentStatus;
  provider: string;
  providerTransactionId?: string;
  paidAt?: string;
}
