// User types
export enum Role {
  ADMINISTRATOR = 'ADMINISTRATOR',
  COORDINATOR = 'COORDINATOR',
  DRIVER = 'DRIVER',
}

export interface User {
  id: string;
  auth0Id: string;
  email: string;
  name: string | null;
  picture: string | null;
  role: Role;
  isApproved: boolean;
  driver?: Driver | null;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
}

// Department types
export enum Department {
  OFFICE_OF_DEVELOPMENT = 'OFFICE_OF_DEVELOPMENT',
  ADMIN = 'ADMIN',
}

export enum ArrivalMode {
  FLIGHT = 'FLIGHT',
  SELF_DRIVING = 'SELF_DRIVING',
}

// VIP types
export interface VIP {
  id: string;
  name: string;
  organization: string | null;
  department: Department;
  arrivalMode: ArrivalMode;
  expectedArrival: string | null;
  airportPickup: boolean;
  venueTransport: boolean;
  notes: string | null;
  flights?: Flight[];
  events?: ScheduleEvent[];
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
}

// Driver types
export interface Driver {
  id: string;
  name: string;
  phone: string;
  department: Department | null;
  userId: string | null;
  user?: User | null;
  events?: ScheduleEvent[];
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
}

// Vehicle types
export enum VehicleType {
  VAN = 'VAN',
  SUV = 'SUV',
  SEDAN = 'SEDAN',
  BUS = 'BUS',
  GOLF_CART = 'GOLF_CART',
  TRUCK = 'TRUCK',
}

export enum VehicleStatus {
  AVAILABLE = 'AVAILABLE',
  IN_USE = 'IN_USE',
  MAINTENANCE = 'MAINTENANCE',
  RESERVED = 'RESERVED',
}

export interface Vehicle {
  id: string;
  name: string;
  type: VehicleType;
  licensePlate: string | null;
  seatCapacity: number;
  status: VehicleStatus;
  currentDriverId: string | null;
  currentDriver?: Driver | null;
  notes: string | null;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
}

// Event types
export enum EventType {
  TRANSPORT = 'TRANSPORT',
  MEETING = 'MEETING',
  EVENT = 'EVENT',
  MEAL = 'MEAL',
  ACCOMMODATION = 'ACCOMMODATION',
}

export enum EventStatus {
  SCHEDULED = 'SCHEDULED',
  IN_PROGRESS = 'IN_PROGRESS',
  COMPLETED = 'COMPLETED',
  CANCELLED = 'CANCELLED',
}

export interface ScheduleEvent {
  id: string;
  vipIds: string[]; // Array of VIP IDs for multi-passenger trips
  vips?: VIP[]; // Populated VIP objects
  title: string;
  location: string | null;
  pickupLocation: string | null;
  dropoffLocation: string | null;
  startTime: string;
  endTime: string;
  description: string | null;
  type: EventType;
  status: EventStatus;
  driverId: string | null;
  driver?: Driver | null;
  vehicleId: string | null;
  vehicle?: Vehicle | null;
  createdAt: string;
  updatedAt: string;
  deletedAt: string | null;
}

// Flight types
export interface Flight {
  id: string;
  vipId: string;
  vip?: VIP;
  flightNumber: string;
  flightDate: string;
  segment: number;
  departureAirport: string;
  arrivalAirport: string;
  scheduledDeparture: string | null;
  scheduledArrival: string | null;
  actualDeparture: string | null;
  actualArrival: string | null;
  status: string | null;
  createdAt: string;
  updatedAt: string;
}
