export interface Station {
  id: string;
  name: string;
  code: string;
  country: string;
  latitude?: number;
  longitude?: number;
}

export interface Schedule {
  id?: string; // For backward compatibility
  scheduleId?: string; // API returns this
  trainNumber: string;
  trainName?: string;
  origin?: {
    id: string;
    code: string;
    name: string;
    city: string;
    sequence: number;
  };
  destination?: {
    id: string;
    code: string;
    name: string;
    city: string;
    sequence: number;
  };
  originStation?: Station; // For backward compatibility
  destinationStation?: Station; // For backward compatibility
  departureAt?: string; // API returns this
  arrivalAt?: string; // API returns this
  departureTime?: string; // For backward compatibility
  arrivalTime?: string; // For backward compatibility
  durationMinutes?: number; // API returns this
  duration?: string; // For backward compatibility
  baseFareAdult?: number;
  baseFareChild?: number;
  availableSeats?: number;
  availabilityByClass?: Record<string, number>; // API returns this
  faresByClass?: Array<{ seatClassName: string; baseFareMinor: number }>; // API returns this
  coachTypes?: Array<{
    coachId: string;
    coachTypeName: string;
    coachTypeCode: string;
    classes: Array<{
      name: string;
      baseFareMinor: number;
    }>;
  }>;
  serviceClass?: string;
  status?: string;
  hasAvailability?: boolean;
  stops?: Array<{
    stationId: string;
    stationName: string;
    sequence: number;
    plannedArrivalAt?: string;
    plannedDepartureAt?: string;
  }>; // API returns this
}

export interface Coach {
  id: string;
  coachNumber: string;
  coachClass: string;
  totalSeats: number;
  availableSeats: number;
}

export interface Seat {
  id: string;
  seatNumber: string;
  status: 'AVAILABLE' | 'HELD' | 'BOOKED' | 'BLOCKED';
  coachId: string;
  premiumSurcharge?: number;
}

export interface Booking {
  id: string;
  pnr: string;
  status: 'DRAFT' | 'CONFIRMED' | 'CANCELLED';
  totalFare: number;
  expiresAt?: string;
  passengers: BookingPassenger[];
}

export interface BookingPassenger {
  id: string;
  name: string;
  dateOfBirth: string;
  seatNumber?: string;
  ticketNumber?: string;
}

export interface Ticket {
  id: string;
  ticketNumber: string;
  passengerName: string;
  seatNumber: string;
  qrCode: string;
  trainDetails: {
    trainNumber: string;
    origin: string;
    destination: string;
    departureTime: string;
    arrivalTime: string;
  };
}

export interface FaydaVerificationResponse {
  verified: boolean;
  passengerData?: {
    fullName: string;
    dateOfBirth: string;
    gender: string;
    nationality: string;
  };
}

export interface PaymentMethod {
  id: string;
  type: string;
  displayName: string;
  region: string;
  currency: string;
  providerId: string | null;
  isDefault: boolean;
  enabled: boolean;
  sortOrder: number;
  createdAt: string;
  updatedAt: string;
}
