/**
 * Which trip documents may reach a driver's browser (Nash, 2026-10-07, item 9):
 * rate confirmations carry the load's pay and are for carrier or dispatch
 * staff only, so they are never signed or listed for the driver app.
 */
export const DRIVER_DOCUMENT_KINDS = ['permit', 'provision', 'route', 'other'] as const

export function isDriverVisibleDocument(doc: { kind: string }): boolean {
  return (DRIVER_DOCUMENT_KINDS as readonly string[]).includes(doc.kind)
}

/** The documents a driver may open: everything except rate confirmations and unknown kinds. */
export function driverVisibleDocuments<T extends { kind: string }>(docs: T[]): T[] {
  return docs.filter(isDriverVisibleDocument)
}
