{
 "openapi": "3.1.0",
 "info": {
  "title": "Drivers (Supply Chain)",
  "version": "20261030b",
  "description": "Who drives. The hours are the point: a driver out of hours is a load that does not go, and scheduling a run that breaks the rules is the most expensive mistake a transport planner can make."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "drivers": {
    "type": "object",
    "required": [
     "code",
     "first_name",
     "last_name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "code": {
      "type": "string",
      "description": "Code"
     },
     "first_name": {
      "type": "string",
      "description": "First name"
     },
     "last_name": {
      "type": "string",
      "description": "Last name"
     },
     "employee_id": {
      "type": "string",
      "format": "uuid",
      "description": "Employee"
     },
     "carrier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Carrier"
     },
     "phone": {
      "type": "string",
      "description": "Telephone"
     },
     "email": {
      "type": "string",
      "description": "Email"
     },
     "licence_no": {
      "type": "string",
      "description": "License number"
     },
     "licence_class": {
      "type": "string",
      "description": "License class"
     },
     "licence_expires_on": {
      "type": "string",
      "format": "date",
      "description": "License expires"
     },
     "cpc_expires_on": {
      "type": "string",
      "format": "date",
      "description": "Driver qualification expires"
     },
     "adr_certified": {
      "type": "boolean",
      "description": "Certified for dangerous goods"
     },
     "adr_expires_on": {
      "type": "string",
      "format": "date",
      "description": "Dangerous goods certificate expires"
     },
     "medical_expires_on": {
      "type": "string",
      "format": "date",
      "description": "Medical expires"
     },
     "max_daily_drive_hours": {
      "type": "string",
      "format": "decimal",
      "description": "Maximum driving hours a day"
     },
     "max_weekly_drive_hours": {
      "type": "string",
      "format": "decimal",
      "description": "Maximum driving hours a week"
     },
     "hours_driven_today": {
      "type": "string",
      "format": "decimal",
      "description": "Hours driven today",
      "readOnly": true
     },
     "hours_driven_week": {
      "type": "string",
      "format": "decimal",
      "description": "Hours driven week",
      "readOnly": true
     },
     "last_rest_ended_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last rest ended at",
      "readOnly": true
     },
     "home_location_id": {
      "type": "string",
      "format": "uuid",
      "description": "Based at"
     },
     "cost_per_hour": {
      "type": "string",
      "format": "decimal",
      "description": "Cost an hour"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "available",
       "driving",
       "resting",
       "on_leave",
       "training",
       "unavailable",
       "terminated"
      ]
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/scm/drivers": {
   "get": {
    "summary": "list drivers",
    "operationId": "list_drivers_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create drivers",
    "operationId": "create_drivers_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/drivers/{id}": {
   "get": {
    "summary": "get drivers",
    "operationId": "get_drivers_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change drivers",
    "operationId": "change_drivers_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete drivers",
    "operationId": "delete_drivers_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/drivers/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_drivers_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}