/**
 * TypeScript type declarations for the Trident Taxis MCP tools.
 *
 * Endpoint:         https://tridenttaxis.online/mcp
 * Server:           trident-taxis-mcp v0.1.0
 * Protocol version: 2025-06-18
 *
 * These types mirror the JSON Schema files published alongside this file
 * (see /mcp-schemas/index.json). Drop this file into any TypeScript project
 * to get typed inputs and outputs for `tools/call` payloads.
 */

export type VehicleType =
  | "saloon"
  | "estate"
  | "executive"
  | "6seater"
  | "mpv"
  | "wav";

export type TariffRate = "day" | "night" | "holiday";

/* ------------------------- estimate_fare ---------------------------------- */

export interface EstimateFareInput {
  /** Pickup address or place name. 3–200 chars. */
  pickup: string;
  /** Dropoff address or place name. 3–200 chars. */
  dropoff: string;
  /** Vehicle class. Defaults to `saloon`. */
  vehicleType?: VehicleType;
  /** ISO 8601 planned departure time (UTC). */
  departAt?: string;
  /** Whether an airport meet & greet is requested (+£25). */
  meetAndGreet?: boolean;
}

export interface EstimateFareOutput {
  fareGBP: number;
  distanceMiles: number;
  durationSeconds: number;
  rate: TariffRate;
  airportSurchargeGBP: number;
  tariffVersion: string;
  appliedRules?: string[];
}

/* ------------------------- get_service_info ------------------------------- */

export type GetServiceInfoInput = Record<string, never>;

export interface ServiceVehicle {
  id: VehicleType;
  maxPassengers: number;
  note?: string;
}

export interface GetServiceInfoOutput {
  brand: string;
  area: string;
  vehicles: ServiceVehicle[];
  surcharges: {
    preBookingGBP: number;
    airportPickupOrDropGBP: number;
    airportMeetAndGreetGBP: number;
    eightSeaterLocalMultiplier: number;
  };
  tariffs: string[];
  bookingUrl: string;
}

/* ------------------------- start_booking ---------------------------------- */

export type BookableVehicleType = "saloon" | "mpv" | "wav";

export interface StartBookingInput {
  pickup: string;
  dropoff: string;
  vehicleType: BookableVehicleType;
  departAt?: string;
  meetAndGreet?: boolean;
  /** Integer 1–8. Validated against vehicle capacity. */
  passengers?: number;
}

export interface StartBookingOutput {
  bookingUrl: string;
  confirmed: false;
  requiresPassengerAction: true;
  quote: {
    fareGBP: number;
    distanceMiles: number;
    durationSeconds: number;
    rate: TariffRate;
    vehicleType: BookableVehicleType;
    tariffVersion: string;
  };
  prefilled: {
    pickup: string;
    dropoff: string;
    vehicleType: BookableVehicleType;
    departAt: string | null;
    meetAndGreet: boolean;
  };
}

/* ------------------------- Tool registry map ------------------------------ */

/** Map of MCP tool names to their `{ input, output }` signatures. */
export interface McpToolMap {
  estimate_fare: { input: EstimateFareInput; output: EstimateFareOutput };
  get_service_info: { input: GetServiceInfoInput; output: GetServiceInfoOutput };
  start_booking: { input: StartBookingInput; output: StartBookingOutput };
}

export type McpToolName = keyof McpToolMap;
export type McpToolInput<T extends McpToolName> = McpToolMap[T]["input"];
export type McpToolOutput<T extends McpToolName> = McpToolMap[T]["output"];
