/** Lightweight per-trip rows fetched for the role dashboards. */

export interface PermitLite {
  id: string
  trip_id: string
  document_id: string | null
  state_code: string
  permit_number: string | null
  effective_date: string | null
  expiration_date: string | null
  route_processing_status?: 'queued' | 'ready' | 'needs_preparation' | 'failed' | 'unsupported'
  /** 'synchron' when the permit was pushed by Synchron Permits — its route is included (D5). */
  source_system?: string | null
  route_links?: string[] | null
  route_gpx_url?: string | null
  route_hummer_url?: string | null
  /** State permit fee (migration 0033). Absent for a pilot — the server strips it. */
  permit_cost_amount?: number | null
  permit_cost_currency?: string | null
  permit_cost_status?: 'found' | 'not_found' | 'needs_review' | 'manually_entered' | 'corrected'
  permit_cost_manual_override?: number | null
  cost_counts_toward_total?: boolean
}

export interface TripDriver {
  trip_id: string
  name: string
  email: string
}

/**
 * Route requests per trip, for the driver's Active Trip route section.
 * A purchased route is delivered in THREE formats (2026-09-07 meeting):
 * Google Maps (1..N parts), a GPX file, and a Hummer GPS deep link.
 */
export interface RouteRequestLite {
  id: string
  trip_id: string
  type: string
  state_code: string | null
  status: string
  route_type: 'express' | 'extended' | null
  route_links: string[] | null
  route_gpx_url: string | null
  route_hummer_url: string | null
  /** Who ordered it — shown to everyone on the trip (Task 70). */
  requested_by: string | null
  requester_label: string
  /** Permit requests only: the expired permit being re-ordered (Task 75). */
  replaces_permit_id: string | null
}

/**
 * A pilot car on a trip and the states it is assigned — one badge each on
 * the broker and carrier dashboards (Nash, 2026-09-17: "if it's two
 * different pilot cars… it should visually represent that there are two
 * different pilot cars for that trip"). No contact details.
 */
export interface TripPilot {
  trip_id: string
  participant_id: string
  name: string
  email: string
  invited_by: string | null
  /** The access line as written to the trip history ("States: NM, AZ", "Full trip (all states)", "Decide later"). */
  access: string
  /** Concrete states from that access, resolved against the trip's permits. */
  states: string[]
}
