openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 1.0.0 description: MOVE Apayao — Transit & Trip Booking API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication and user profile - name: drivers description: Driver GPS and availability - name: trips description: Point-to-point trip booking - name: loops description: Fixed-loop route tracking - name: wallet description: Fare wallet and transactions - name: incidents description: Incident reporting - name: analytics description: Reporting and analytics - name: weather description: Weather proxy - name: subscriptions description: Subscription management - name: gis description: Privileged internal GIS Intelligence gateway - name: iot description: Developer/superadmin fleet GPS provisioning and device telemetry - name: docs description: Developer/superadmin internal operational documentation paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" "503": description: A required dependency is unavailable or unconfigured content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /livez: get: operationId: livenessCheck tags: [health] summary: Process liveness check responses: "200": description: Process is running content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /docs/internal/runbooks: get: operationId: listInternalRunbooks tags: [docs] summary: Read protected operational runbooks description: Runbook content is returned only to active developer or superadmin accounts and must not be cached. security: [{ bearerAuth: [] }] responses: "200": description: Protected runbook collection headers: Cache-Control: schema: { type: string } content: application/json: schema: $ref: "#/components/schemas/InternalRunbooksResponse" "401": $ref: "#/components/responses/Unauthorized" "403": description: Developer or superadmin role required content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" # ── Auth ──────────────────────────────────────────────────────────────────── /auth/register: post: operationId: registerUser tags: [auth] summary: Create an account and sign in requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterUserBody" responses: "201": description: Account created and signed in content: application/json: schema: $ref: "#/components/schemas/SessionResponse" "400": $ref: "#/components/responses/BadRequest" "409": $ref: "#/components/responses/Conflict" /auth/login: post: operationId: login tags: [auth] summary: Sign in with email or phone requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginBody" responses: "200": description: Signed in content: application/json: schema: $ref: "#/components/schemas/SessionResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" /auth/refresh: post: operationId: refreshSession tags: [auth] summary: Exchange a refresh token for a new session description: > Refresh tokens are single-use. Each call rotates the token, so the caller must store the newly returned refreshToken. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RefreshBody" responses: "200": description: New session issued content: application/json: schema: $ref: "#/components/schemas/SessionTokens" "401": $ref: "#/components/responses/Unauthorized" /auth/logout: post: operationId: logout tags: [auth] summary: Revoke a refresh token requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RefreshBody" responses: "204": description: Signed out /auth/logout-all: post: operationId: logoutAll tags: [auth] summary: Sign out of every device security: [{ bearerAuth: [] }] responses: "204": description: All sessions revoked "401": $ref: "#/components/responses/Unauthorized" /auth/forgot-password: post: operationId: forgotPassword tags: [auth] summary: Request a password reset email description: > Always returns 200 whether or not the address is registered, so the endpoint cannot be used to discover which emails have accounts. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ForgotPasswordBody" responses: "200": description: Accepted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" "400": $ref: "#/components/responses/BadRequest" /auth/reset-password: post: operationId: resetPassword tags: [auth] summary: Set a new password using a reset token requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ResetPasswordBody" responses: "200": description: Password updated content: application/json: schema: $ref: "#/components/schemas/MessageResponse" "400": $ref: "#/components/responses/BadRequest" /auth/change-password: post: operationId: changePassword tags: [auth] summary: Change your password while signed in security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ChangePasswordBody" responses: "200": description: Password changed content: application/json: schema: $ref: "#/components/schemas/MessageResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" /auth/profile: get: operationId: getProfile tags: [auth] summary: Get current user profile security: [{ bearerAuth: [] }] responses: "200": description: User profile content: application/json: schema: $ref: "#/components/schemas/ProfileResponse" patch: operationId: updateProfile tags: [auth] summary: Update user profile security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProfileBody" responses: "200": description: Updated profile content: application/json: schema: $ref: "#/components/schemas/UpdateProfileResponse" /auth/deactivate-account: post: operationId: deactivateAccount tags: [auth] summary: Deactivate the current account and revoke every session security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DeactivateAccountBody" responses: "200": description: Account deactivated content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/users: get: operationId: listUsers tags: [auth] summary: List all users (admin only) security: [{ bearerAuth: [] }] parameters: - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: User list content: application/json: schema: $ref: "#/components/schemas/ListUsersResponse" # ── Drivers ───────────────────────────────────────────────────────────────── /drivers/location: put: operationId: updateDriverLocation tags: [drivers] summary: Push driver GPS location (driver only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateLocationBody" responses: "200": description: Location updated content: application/json: schema: $ref: "#/components/schemas/OkResponse" /admin/gis/overview: get: operationId: getGisOverview tags: [gis] summary: Get privileged GIS collection and candidate statistics security: [{ bearerAuth: [] }] responses: "200": description: GIS overview content: application/json: schema: $ref: "#/components/schemas/GisOverview" "403": description: Developer or superadmin role required /admin/gis/tracks/recent: get: operationId: getRecentGisTracks tags: [gis] summary: Get recent cleaned driver tracks as GeoJSON security: [{ bearerAuth: [] }] parameters: - name: hours in: query schema: type: integer minimum: 1 maximum: 168 default: 24 - name: limit in: query schema: type: integer minimum: 1 maximum: 100 default: 50 responses: "200": description: GeoJSON track collection content: application/json: schema: $ref: "#/components/schemas/GisTrackCollection" "403": description: Developer or superadmin role required /admin/gis/candidates: get: operationId: listGisCandidates tags: [gis] summary: List isolated GIS route candidates security: [{ bearerAuth: [] }] responses: "200": description: GIS route candidates content: application/json: schema: $ref: "#/components/schemas/GisCandidateList" "403": description: Developer or superadmin role required /admin/gis/candidates/generate: post: operationId: generateGisCandidates tags: [gis] summary: Generate review-only route candidates from repeated cleaned GPS corridors security: [{ bearerAuth: [] }] requestBody: content: application/json: schema: $ref: "#/components/schemas/GenerateGisCandidatesBody" responses: "200": description: Candidate analysis result content: application/json: schema: $ref: "#/components/schemas/GenerateGisCandidatesResponse" "403": description: Developer or superadmin role required /admin/gis/candidates/{id}/review: patch: operationId: reviewGisCandidate tags: [gis] summary: Record a privileged review decision without publishing a route security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ReviewGisCandidateBody" responses: "200": description: Candidate review recorded content: application/json: schema: type: object properties: candidate: $ref: "#/components/schemas/GisRouteCandidate" required: [candidate] "403": description: Developer or superadmin role required "409": description: Candidate already has a final decision /drivers/nearby: get: operationId: getNearbyDrivers tags: [drivers] summary: Get nearby available drivers security: [{ bearerAuth: [] }] parameters: - name: lat in: query required: true schema: type: number - name: lon in: query required: true schema: type: number - name: radius in: query schema: type: number default: 5 responses: "200": description: Nearby drivers content: application/json: schema: $ref: "#/components/schemas/NearbyDriversResponse" /drivers/availability: put: operationId: updateDriverAvailability tags: [drivers] summary: Toggle driver availability (driver only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AvailabilityBody" responses: "200": description: Availability updated content: application/json: schema: $ref: "#/components/schemas/DriverProfileResponse" /drivers/me: get: operationId: getMyDriverProfile tags: [drivers] summary: Get own driver profile (driver only) security: [{ bearerAuth: [] }] responses: "200": description: Driver profile content: application/json: schema: $ref: "#/components/schemas/DriverProfileResponse" /admin/drivers/{id}/approval: patch: operationId: updateDriverApproval tags: [drivers] summary: Approve or reject a driver application (admin only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DriverApprovalBody" responses: "200": description: Driver application updated content: application/json: schema: $ref: "#/components/schemas/DriverApprovalResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": description: Administrator role required "404": $ref: "#/components/responses/NotFound" "409": description: Invalid driver status transition /admin/drivers/applications: get: operationId: listDriverApplications tags: [drivers] summary: List driver applications and review counts (admin only) security: [{ bearerAuth: [] }] responses: "200": description: Driver application queue and review history content: application/json: schema: $ref: "#/components/schemas/DriverApplicationsResponse" "401": $ref: "#/components/responses/Unauthorized" "403": description: Administrator role required # ── Trips ──────────────────────────────────────────────────────────────────── /trips: post: operationId: createTrip tags: [trips] summary: Request a trip (passenger only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateTripBody" responses: "201": description: Trip created content: application/json: schema: $ref: "#/components/schemas/TripResponse" get: operationId: listTrips tags: [trips] summary: Get trip history security: [{ bearerAuth: [] }] parameters: - name: limit in: query schema: type: integer default: 20 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Trip list content: application/json: schema: $ref: "#/components/schemas/ListTripsResponse" /trips/fare-estimate: post: operationId: previewTripFare tags: [trips] summary: Preview road distance, route geometry, and fare (passenger only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TripRouteBody" responses: "200": description: Fare and road route preview content: application/json: schema: $ref: "#/components/schemas/TripFarePreviewResponse" /admin/fare-policy: get: operationId: getActiveFarePolicy tags: [fares] summary: Get the active point-to-point fare policy (admin only) security: [{ bearerAuth: [] }] responses: "200": description: Active fare policy content: application/json: schema: $ref: "#/components/schemas/FarePolicyResponse" put: operationId: updateFarePolicy tags: [fares] summary: Activate a new versioned fare policy (admin only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateFarePolicyBody" responses: "200": description: Newly activated fare policy content: application/json: schema: $ref: "#/components/schemas/FarePolicyResponse" /trips/{id}: get: operationId: getTrip tags: [trips] summary: Get trip details security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Trip details content: application/json: schema: $ref: "#/components/schemas/TripResponse" "404": $ref: "#/components/responses/NotFound" /trips/{id}/track/ticket: post: operationId: createTripTrackingTicket tags: [trips] summary: Create a short-lived ticket for the trip location stream security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Short-lived trip tracking ticket content: application/json: schema: $ref: "#/components/schemas/TrackingTicketResponse" "404": $ref: "#/components/responses/NotFound" /trips/{id}/accept: post: operationId: acceptTrip tags: [trips] summary: Driver accepts a trip security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Trip accepted content: application/json: schema: $ref: "#/components/schemas/TripResponse" /trips/{id}/decline: post: operationId: declineTrip tags: [trips] summary: Driver declines a trip security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DeclineTripBody" responses: "200": description: Trip declined and re-queued content: application/json: schema: $ref: "#/components/schemas/TripResponse" /trips/{id}/arrive: post: operationId: arriveTrip tags: [trips] summary: Driver confirms arrival at pickup security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Driver arrived content: application/json: schema: $ref: "#/components/schemas/TripResponse" /trips/{id}/start: post: operationId: startTrip tags: [trips] summary: Verify passenger pickup PIN and start the ride security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StartTripBody" responses: "200": description: Trip started content: application/json: schema: $ref: "#/components/schemas/TripResponse" /trips/{id}/complete: post: operationId: completeTrip tags: [trips] summary: Driver marks trip complete and deducts fare security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Trip completed content: application/json: schema: $ref: "#/components/schemas/TripResponse" /trips/{id}/cancel: post: operationId: cancelTrip tags: [trips] summary: Cancel a trip security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CancelTripBody" responses: "200": description: Trip cancelled content: application/json: schema: $ref: "#/components/schemas/TripResponse" /trips/{id}/rate: post: operationId: rateTrip tags: [trips] summary: Rate a completed trip security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RateTripBody" responses: "201": description: Rating submitted content: application/json: schema: $ref: "#/components/schemas/TripRatingResponse" /notifications/device: put: operationId: registerNotificationDevice tags: [auth] summary: Register or refresh a push notification destination security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterNotificationDeviceBody" responses: "200": description: Device registered content: application/json: schema: $ref: "#/components/schemas/OkResponse" delete: operationId: unregisterNotificationDevice tags: [auth] summary: Remove a push notification destination security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: type: object properties: token: { type: string } required: [token] responses: "204": description: Device removed # ── Loop Routes ────────────────────────────────────────────────────────────── /loops: get: operationId: listLoopRoutes tags: [loops] summary: List all active loop routes responses: "200": description: Loop routes content: application/json: schema: $ref: "#/components/schemas/ListLoopRoutesResponse" post: operationId: createLoopRoute tags: [loops] summary: Create a loop route with stops (admin only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateLoopRouteBody" responses: "201": description: Loop route created content: application/json: schema: $ref: "#/components/schemas/LoopRouteDetailResponse" /loops/{id}: get: operationId: getLoopRoute tags: [loops] summary: Get loop route with stops parameters: - name: id in: path required: true schema: type: integer - name: includeRoute in: query required: false description: Compute transient road geometry for display on a Google Map. schema: type: boolean responses: "200": description: Route detail content: application/json: schema: $ref: "#/components/schemas/LoopRouteDetailResponse" "404": $ref: "#/components/responses/NotFound" /admin/loops/route-preview: post: operationId: previewLoopRoute tags: [loops] summary: Preview a road-following loop route (admin only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PreviewLoopRouteBody" responses: "200": description: Road route preview content: application/json: schema: $ref: "#/components/schemas/DrivingRouteResponse" /loops/{id}/vehicles: get: operationId: getLoopVehicles tags: [loops] summary: Get live vehicles on a route with ETAs parameters: - name: id in: path required: true schema: type: integer - name: lat in: query schema: type: number - name: lon in: query schema: type: number responses: "200": description: Vehicles with ETA content: application/json: schema: $ref: "#/components/schemas/LoopVehiclesResponse" /loops/{id}/vehicles/location: put: operationId: updateLoopVehicleLocation tags: [loops] summary: Push loop vehicle GPS location (driver only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateLoopLocationBody" responses: "200": description: Vehicle location updated content: application/json: schema: $ref: "#/components/schemas/LoopVehicleResponse" /admin/loops/{id}/vehicles: get: operationId: listLoopDriverAssignments tags: [loops] summary: List private driver assignments for a loop (admin only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: integer } responses: "200": description: Loop driver assignments content: application/json: schema: $ref: "#/components/schemas/LoopDriverAssignmentsResponse" post: operationId: assignLoopDriver tags: [loops] summary: Assign an approved driver to a loop (admin only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: integer } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AssignLoopDriverBody" responses: "201": description: Driver assigned content: application/json: schema: type: object properties: assignment: $ref: "#/components/schemas/LoopDriverAssignment" required: [assignment] "409": $ref: "#/components/responses/Conflict" /admin/loops/{id}/vehicles/{vehicleId}: delete: operationId: unassignLoopDriver tags: [loops] summary: Remove a driver assignment from a loop (admin only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: integer } - name: vehicleId in: path required: true schema: { type: integer } responses: "204": description: Driver unassigned "404": $ref: "#/components/responses/NotFound" # ── Wallet ─────────────────────────────────────────────────────────────────── /wallet: get: operationId: getWallet tags: [wallet] summary: Get current user's wallet security: [{ bearerAuth: [] }] responses: "200": description: Wallet content: application/json: schema: $ref: "#/components/schemas/WalletResponse" /wallet/transactions: get: operationId: listTransactions tags: [wallet] summary: Get transaction history security: [{ bearerAuth: [] }] parameters: - name: limit in: query schema: type: integer default: 20 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Transaction history content: application/json: schema: $ref: "#/components/schemas/ListTransactionsResponse" /wallet/tap: post: operationId: tapWallet tags: [wallet] summary: "[DEFERRED] NFC/QR card tap — deduct fare" description: > DEFERRED pending reader hardware procurement. Returns 503 unless the server sets FEATURE_QR_FARE_COLLECTION=true. Fares are currently collected in cash by the driver at drop-off. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TapBody" responses: "200": description: Tap processed content: application/json: schema: $ref: "#/components/schemas/TapResponse" "402": description: Insufficient balance /wallet/admin/users: get: operationId: listWallets tags: [wallet] summary: List all user wallets (admin only) security: [{ bearerAuth: [] }] parameters: - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Wallet list content: application/json: schema: $ref: "#/components/schemas/ListWalletsResponse" # ── Incidents ──────────────────────────────────────────────────────────────── /incidents: post: operationId: createIncident tags: [incidents] summary: Submit an incident report security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateIncidentBody" responses: "201": description: Incident reported content: application/json: schema: $ref: "#/components/schemas/IncidentResponse" get: operationId: listIncidents tags: [incidents] summary: List incidents security: [{ bearerAuth: [] }] parameters: - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Incident list content: application/json: schema: $ref: "#/components/schemas/ListIncidentsResponse" /incidents/{id}: get: operationId: getIncident tags: [incidents] summary: Get incident details security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Incident content: application/json: schema: $ref: "#/components/schemas/IncidentResponse" "404": $ref: "#/components/responses/NotFound" patch: operationId: updateIncident tags: [incidents] summary: Update incident status (admin only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateIncidentBody" responses: "200": description: Updated incident content: application/json: schema: $ref: "#/components/schemas/IncidentResponse" # ── Analytics ──────────────────────────────────────────────────────────────── /analytics/daily: get: operationId: getDailyAnalytics tags: [analytics] summary: Daily trip metrics (admin only) security: [{ bearerAuth: [] }] parameters: - name: startDate in: query schema: type: string format: date - name: endDate in: query schema: type: string format: date responses: "200": description: Daily analytics content: application/json: schema: $ref: "#/components/schemas/DailyAnalyticsResponse" /analytics/summary: get: operationId: getAnalyticsSummary tags: [analytics] summary: Overall KPI summary (admin only) security: [{ bearerAuth: [] }] responses: "200": description: Analytics summary content: application/json: schema: $ref: "#/components/schemas/AnalyticsSummaryResponse" /analytics/trips: get: operationId: getAllTrips tags: [analytics] summary: All trips with filtering (admin only) security: [{ bearerAuth: [] }] parameters: - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 - name: status in: query schema: type: string - name: driverId in: query schema: type: string - name: passengerId in: query schema: type: string responses: "200": description: Trip list content: application/json: schema: $ref: "#/components/schemas/ListTripsResponse" /analytics/earnings: get: operationId: getEarnings tags: [analytics] summary: Driver earnings report security: [{ bearerAuth: [] }] parameters: - name: driverId in: query schema: type: string - name: startDate in: query schema: type: string format: date - name: endDate in: query schema: type: string format: date responses: "200": description: Earnings by day content: application/json: schema: $ref: "#/components/schemas/EarningsResponse" # ── Weather ─────────────────────────────────────────────────────────────────── /weather: get: operationId: getWeather tags: [weather] summary: Get current weather for a location security: [{ bearerAuth: [] }] parameters: - name: lat in: query schema: type: number default: 18.3 - name: lon in: query schema: type: number default: 121.2 responses: "200": description: Weather data content: application/json: schema: $ref: "#/components/schemas/WeatherResponse" # ── Subscriptions ──────────────────────────────────────────────────────────── /subscriptions/me: get: operationId: getMySubscription tags: [subscriptions] summary: Get current user's subscription security: [{ bearerAuth: [] }] responses: "200": description: Subscription content: application/json: schema: $ref: "#/components/schemas/MySubscriptionResponse" /subscriptions: get: operationId: listSubscriptions tags: [subscriptions] summary: List all subscriptions (admin only) security: [{ bearerAuth: [] }] parameters: - name: status in: query schema: type: string - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Subscription list content: application/json: schema: $ref: "#/components/schemas/ListSubscriptionsResponse" post: operationId: createSubscription tags: [subscriptions] summary: Create/renew subscription for a user (admin only) security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSubscriptionBody" responses: "201": description: Subscription created content: application/json: schema: $ref: "#/components/schemas/SubscriptionResponse" /subscriptions/{id}: patch: operationId: updateSubscription tags: [subscriptions] summary: Update subscription status (admin only) security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateSubscriptionBody" responses: "200": description: Updated subscription content: application/json: schema: $ref: "#/components/schemas/SubscriptionResponse" # Hardware-neutral IoT GPS management. Management endpoints are restricted # to developer/superadmin roles; ingestion uses per-device credentials. /iot/fleet: get: operationId: getIotFleet tags: [iot] summary: List IoT vehicles, trackers, and active assignments security: [{ bearerAuth: [] }] responses: "200": description: IoT fleet state content: application/json: schema: type: object additionalProperties: true /iot/vehicles: post: operationId: createIotVehicle tags: [iot] summary: Register a fleet vehicle security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateIotVehicleBody" responses: "201": description: Vehicle created content: application/json: schema: type: object additionalProperties: true /iot/devices/provision: post: operationId: provisionGpsDevice tags: [iot] summary: Provision or replace a vehicle GPS device description: Returns the raw device token once. Store it immediately. security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProvisionGpsDeviceBody" responses: "201": description: Device provisioned content: application/json: schema: type: object additionalProperties: true /iot/assignments: post: operationId: assignIotVehicle tags: [iot] summary: Assign an approved driver to a fleet vehicle security: [{ bearerAuth: [] }] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AssignIotVehicleBody" responses: "201": description: Assignment created content: application/json: schema: type: object additionalProperties: true /iot/devices/{id}/revoke: patch: operationId: revokeGpsDevice tags: [iot] summary: Revoke a GPS device credential security: [{ bearerAuth: [] }] parameters: - name: id in: path required: true schema: { type: string, format: uuid } responses: "200": description: Device revoked content: application/json: schema: type: object additionalProperties: true /iot/v1/locations: post: operationId: ingestGpsLocation tags: [iot] summary: Ingest one authenticated GPS observation description: "Use Authorization: Device and the provisioned external ID." parameters: - name: X-Device-ID in: header required: true schema: { type: string } - name: Authorization in: header required: true schema: { type: string } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DeviceLocationBody" responses: "202": description: Observation accepted content: application/json: schema: type: object additionalProperties: true components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT responses: BadRequest: description: Bad request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" Unauthorized: description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" NotFound: description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" Conflict: description: Conflict content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" schemas: HealthStatus: type: object properties: status: type: string enum: [ok, degraded] dependencies: type: object additionalProperties: type: string required: [status] ErrorResponse: type: object properties: error: type: string required: [error] OkResponse: type: object properties: ok: type: boolean required: [ok] InternalRunbook: type: object properties: id: { type: string } title: { type: string } purpose: { type: string } steps: type: array items: { type: string } escalation: { type: string } required: [id, title, purpose, steps, escalation] InternalRunbooksResponse: type: object properties: version: { type: string } updatedAt: { type: string, format: date } runbooks: type: array items: $ref: "#/components/schemas/InternalRunbook" required: [version, updatedAt, runbooks] # ── Users / Auth ───────────────────────────────────────────────────────── User: type: object properties: id: type: string format: uuid email: type: string fullName: type: string nullable: true phone: type: string nullable: true role: type: string enum: [passenger, driver_applicant, driver, admin, superadmin, developer] avatarUrl: type: string nullable: true isActive: type: boolean driverApplicationStatus: type: string enum: [pending, approved, rejected, revoked] driverApplicationReason: type: string nullable: true createdAt: type: string format: date-time updatedAt: type: string format: date-time required: [id, email, role, isActive, createdAt, updatedAt] RegisterUserBody: type: object properties: email: type: string format: email password: type: string minLength: 8 fullName: type: string phone: type: string role: type: string enum: [passenger, driver_applicant] description: Use driver_applicant for driver applications; public registration cannot grant the driver role. vehicleType: type: string licenseNumber: type: string plateNumber: type: string vehicleColor: type: string acceptedTerms: type: boolean const: true termsVersion: type: string default: "2026-08-27" required: [email, password, fullName, role, acceptedTerms] LoginBody: type: object properties: identifier: type: string description: Email address or phone number. password: type: string client: type: string enum: [mobile, dashboard] description: Dashboard sessions keep the refresh token in an HttpOnly cookie. required: [identifier, password] RefreshBody: type: object properties: refreshToken: type: string required: [refreshToken] ForgotPasswordBody: type: object properties: email: type: string format: email required: [email] ResetPasswordBody: type: object properties: token: type: string password: type: string minLength: 8 required: [token, password] ChangePasswordBody: type: object properties: currentPassword: type: string newPassword: type: string minLength: 8 required: [currentPassword, newPassword] DeactivateAccountBody: type: object properties: password: type: string reason: type: string maxLength: 500 required: [password] SessionTokens: type: object properties: accessToken: type: string refreshToken: type: string expiresIn: type: integer description: Access token lifetime in seconds. required: [accessToken, refreshToken, expiresIn] SessionResponse: type: object properties: user: $ref: "#/components/schemas/User" accessToken: type: string refreshToken: type: string expiresIn: type: integer required: [user, accessToken, refreshToken, expiresIn] MessageResponse: type: object properties: message: type: string required: [message] ProfileResponse: type: object properties: user: $ref: "#/components/schemas/User" wallet: $ref: "#/components/schemas/Wallet" subscription: $ref: "#/components/schemas/Subscription" driverProfile: $ref: "#/components/schemas/DriverProfile" required: [user] UpdateProfileBody: type: object properties: fullName: type: string phone: type: string avatarUrl: type: string UpdateProfileResponse: type: object properties: user: $ref: "#/components/schemas/User" required: [user] ListUsersResponse: type: object properties: users: type: array items: $ref: "#/components/schemas/User" limit: type: integer offset: type: integer required: [users, limit, offset] # ── Driver Profile ─────────────────────────────────────────────────────── DriverProfile: type: object properties: id: type: integer userId: type: string format: uuid vehicleType: type: string capacity: type: integer description: Total passenger seats this vehicle can carry. licenseNumber: type: string nullable: true plateNumber: type: string nullable: true vehicleColor: type: string nullable: true approvalStatus: type: string enum: [pending, approved, rejected, revoked] reviewReason: type: string nullable: true reviewedBy: type: string format: uuid nullable: true reviewedAt: type: string format: date-time nullable: true isAvailable: type: boolean isOnShift: type: boolean currentLat: type: number nullable: true currentLon: type: number nullable: true rating: type: number totalTrips: type: integer required: [id, userId, vehicleType, capacity, approvalStatus, isOnShift, isAvailable, rating, totalTrips] DriverProfileResponse: type: object properties: profile: $ref: "#/components/schemas/DriverProfile" required: [profile] DriverApprovalBody: type: object properties: status: type: string enum: [approved, rejected, revoked] reason: type: string minLength: 10 maxLength: 500 description: Required when rejecting an application or revoking driver access. required: [status] DriverApprovalResponse: type: object properties: user: $ref: "#/components/schemas/User" profile: $ref: "#/components/schemas/DriverProfile" required: [user, profile] DriverApplication: type: object properties: userId: type: string format: uuid fullName: type: string nullable: true email: type: string format: email phone: type: string nullable: true avatarUrl: type: string nullable: true isActive: type: boolean vehicleType: type: string vehicleColor: type: string nullable: true capacity: type: integer plateNumber: type: string nullable: true licenseNumber: type: string nullable: true approvalStatus: type: string enum: [pending, approved, rejected, revoked] reviewReason: type: string nullable: true reviewedBy: type: string format: uuid nullable: true reviewedAt: type: string format: date-time nullable: true createdAt: type: string format: date-time updatedAt: type: string format: date-time required: [userId, email, isActive, vehicleType, capacity, approvalStatus, createdAt, updatedAt] DriverApplicationCounts: type: object properties: pending: type: integer approved: type: integer rejected: type: integer revoked: type: integer required: [pending, approved, rejected, revoked] DriverApplicationsResponse: type: object properties: applications: type: array items: $ref: "#/components/schemas/DriverApplication" counts: $ref: "#/components/schemas/DriverApplicationCounts" required: [applications, counts] UpdateLocationBody: type: object properties: lat: type: number lon: type: number capturedAt: type: string format: date-time accuracyM: type: number nullable: true speedMps: type: number nullable: true headingDegrees: type: number nullable: true devicePointId: type: string isMocked: type: boolean required: [lat, lon] GisOverview: type: object properties: totalPoints: { type: integer } points24h: { type: integer } activeDrivers24h: { type: integer } validPoints: { type: integer } mockedPoints: { type: integer } lowAccuracyPoints: { type: integer } averageAccuracyM: { type: number, nullable: true } latestPointAt: { type: string, format: date-time, nullable: true } qualityScore: { type: integer, minimum: 0, maximum: 100 } totalCandidates: { type: integer } draftCandidates: { type: integer } approvedCandidates: { type: integer } generatedAt: { type: string, format: date-time } required: [totalPoints, points24h, activeDrivers24h, validPoints, mockedPoints, lowAccuracyPoints, averageAccuracyM, latestPointAt, qualityScore, totalCandidates, draftCandidates, approvedCandidates, generatedAt] GisLineGeometry: type: object properties: type: type: string enum: [LineString] coordinates: type: array items: type: array minItems: 2 maxItems: 2 items: { type: number } required: [type, coordinates] GisTrackProperties: type: object properties: driverId: { type: string, format: uuid } driverName: { type: string, nullable: true } tripId: { type: integer, nullable: true } trackSession: { type: integer } pointCount: { type: integer } startedAt: { type: string, format: date-time } endedAt: { type: string, format: date-time } required: [driverId, pointCount, startedAt, endedAt] GisTrackFeature: type: object properties: type: type: string enum: [Feature] geometry: $ref: "#/components/schemas/GisLineGeometry" properties: $ref: "#/components/schemas/GisTrackProperties" required: [type, geometry, properties] GisTrackCollection: type: object properties: type: type: string enum: [FeatureCollection] features: type: array items: $ref: "#/components/schemas/GisTrackFeature" generatedAt: { type: string, format: date-time } required: [type, features, generatedAt] GisRouteCandidate: type: object properties: id: { type: integer } name: { type: string } status: { type: string, enum: [draft, reviewing, approved, rejected] } geometryGeoJson: type: object additionalProperties: true supportingRuns: { type: integer } supportingDrivers: { type: integer } confidence: { type: number } distanceKm: { type: number, nullable: true } sourceWindowStart: { type: string, format: date-time, nullable: true } sourceWindowEnd: { type: string, format: date-time, nullable: true } createdAt: { type: string, format: date-time } reviewedAt: { type: string, format: date-time, nullable: true } reviewReason: { type: string, nullable: true } required: [id, name, status, geometryGeoJson, supportingRuns, supportingDrivers, confidence, createdAt] GisCandidateList: type: object properties: candidates: type: array items: $ref: "#/components/schemas/GisRouteCandidate" required: [candidates] GenerateGisCandidatesBody: type: object properties: days: type: integer minimum: 7 maximum: 90 default: 30 GenerateGisCandidatesResponse: type: object properties: days: { type: integer } eligibleCorridors: { type: integer } created: { type: integer } updated: { type: integer } skipped: { type: integer } required: [days, eligibleCorridors, created, updated, skipped] ReviewGisCandidateBody: type: object properties: status: type: string enum: [reviewing, approved, rejected] reason: type: string minLength: 5 maxLength: 500 required: [status, reason] AvailabilityBody: type: object properties: isAvailable: type: boolean required: [isAvailable] NearbyDriver: type: object properties: userId: type: string format: uuid vehicleType: type: string vehicleColor: type: string nullable: true plateNumber: type: string nullable: true isAvailable: type: boolean currentLat: type: number nullable: true currentLon: type: number nullable: true rating: type: number totalTrips: type: integer fullName: type: string nullable: true avatarUrl: type: string nullable: true distanceKm: type: number required: [userId, vehicleType, isAvailable, rating, totalTrips, distanceKm] NearbyDriversResponse: type: object properties: drivers: type: array items: $ref: "#/components/schemas/NearbyDriver" required: [drivers] # ── Trips ──────────────────────────────────────────────────────────────── Trip: type: object properties: id: type: integer passengerId: type: string format: uuid driverId: type: string format: uuid nullable: true vehicleId: type: string format: uuid nullable: true pickupLat: type: number pickupLon: type: number pickupAddress: type: string nullable: true dropoffLat: type: number dropoffLon: type: number dropoffAddress: type: string nullable: true passengerCount: type: integer description: Seats requested for this booking (group booking). clientRequestId: type: string nullable: true pickupCode: type: string nullable: true description: Passenger-only pickup verification PIN. driverRating: type: integer nullable: true description: Rating (1-5) the passenger gave the driver for this trip, if any. driverRatingComment: type: string nullable: true description: Free-text feedback the passenger left with their rating, if any. driverRatingTags: type: array items: { type: string } nullable: true status: type: string enum: [requested, matched, accepted, arrived, in_progress, completing, completed, cancelled] fareAmount: type: number nullable: true farePolicyId: type: integer nullable: true distanceKm: type: number nullable: true routeDurationSeconds: type: integer nullable: true routePolyline: type: string nullable: true distanceSource: type: string nullable: true enum: [google_routes, haversine_fallback] cancelReason: type: string nullable: true cancelReasonCode: type: string nullable: true cancelDetails: type: string nullable: true cancelledBy: type: string format: uuid nullable: true matchedAt: type: string format: date-time nullable: true offerExpiresAt: type: string format: date-time nullable: true acceptedAt: type: string format: date-time nullable: true arrivedAt: type: string format: date-time nullable: true startedAt: type: string format: date-time nullable: true completedAt: type: string format: date-time nullable: true cancelledAt: type: string format: date-time nullable: true createdAt: type: string format: date-time required: [id, passengerId, pickupLat, pickupLon, dropoffLat, dropoffLon, status, createdAt] TripResponse: type: object properties: trip: $ref: "#/components/schemas/Trip" myRating: type: object nullable: true description: The calling user's own rating for this trip, if already given. properties: rating: type: integer comment: type: string nullable: true tags: type: array items: { type: string } required: [rating] passenger: nullable: true allOf: - $ref: "#/components/schemas/TripPassenger" driver: nullable: true allOf: - $ref: "#/components/schemas/TripDriver" idempotentReplay: type: boolean required: [trip] TripPassenger: type: object properties: id: { type: string, format: uuid } fullName: { type: string, nullable: true } phone: { type: string, nullable: true } avatarUrl: { type: string, nullable: true } required: [id] TripDriver: type: object properties: id: { type: string, format: uuid } fullName: { type: string, nullable: true } phone: { type: string, nullable: true } avatarUrl: { type: string, nullable: true } vehicleType: { type: string } vehicleColor: { type: string, nullable: true } plateNumber: { type: string, nullable: true } rating: { type: number } totalTrips: { type: integer } required: [id, vehicleType, rating, totalTrips] ListTripsResponse: type: object properties: trips: type: array items: $ref: "#/components/schemas/Trip" limit: type: integer offset: type: integer required: [trips, limit, offset] TripRouteBody: type: object properties: pickupLat: type: number pickupLon: type: number pickupAddress: type: string dropoffLat: type: number dropoffLon: type: number dropoffAddress: type: string passengerCount: type: integer minimum: 1 maximum: 15 default: 1 description: Seats requested for this booking (group booking). required: [pickupLat, pickupLon, dropoffLat, dropoffLon] CreateTripBody: allOf: - $ref: "#/components/schemas/TripRouteBody" - type: object properties: clientRequestId: type: string minLength: 8 maxLength: 120 required: [clientRequestId] CreateIotVehicleBody: type: object properties: plateNumber: { type: string, minLength: 3, maxLength: 30 } label: { type: string, minLength: 2, maxLength: 100 } vehicleType: { type: string, default: e-jeepney } capacity: { type: integer, minimum: 1, maximum: 100, default: 15 } required: [plateNumber] ProvisionGpsDeviceBody: type: object properties: vehicleId: { type: string, format: uuid } externalId: { type: string, minLength: 4, maxLength: 64 } label: { type: string, minLength: 2, maxLength: 100 } protocol: { type: string, default: https_json_v1 } required: [vehicleId] AssignIotVehicleBody: type: object properties: vehicleId: { type: string, format: uuid } driverId: { type: string, format: uuid } required: [vehicleId, driverId] DeviceLocationBody: type: object properties: eventId: { type: string, minLength: 8, maxLength: 64 } capturedAt: { type: string, format: date-time } lat: { type: number, minimum: -90, maximum: 90 } lon: { type: number, minimum: -180, maximum: 180 } accuracyM: { type: number, nullable: true, minimum: 0, maximum: 10000 } speedMps: { type: number, nullable: true, minimum: 0, maximum: 100 } headingDegrees: { type: number, nullable: true, minimum: 0, maximum: 360 } batteryPercent: { type: number, nullable: true, minimum: 0, maximum: 100 } signalDbm: { type: number, nullable: true, minimum: -200, maximum: 0 } required: [eventId, capturedAt, lat, lon] DeclineTripBody: type: object properties: reason: type: string enum: [too_far, vehicle_issue, unsafe_pickup, personal_emergency, other] required: [reason] StartTripBody: type: object properties: pickupCode: type: string pattern: '^\\d{4}$' required: [pickupCode] CancelTripBody: type: object properties: reason: type: string enum: [changed_mind, wrong_pickup, driver_taking_too_long, cannot_contact_driver, safety_concern, driver_emergency, other] details: type: string maxLength: 300 required: [reason] TripRating: type: object properties: id: type: integer tripId: type: integer raterId: type: string format: uuid rateeId: type: string format: uuid rating: type: integer minimum: 1 maximum: 5 comment: type: string nullable: true tags: type: array items: { type: string } createdAt: type: string format: date-time required: [id, tripId, raterId, rateeId, rating, createdAt] TripRatingResponse: type: object properties: rating: $ref: "#/components/schemas/TripRating" required: [rating] RateTripBody: type: object properties: rating: type: integer minimum: 1 maximum: 5 comment: type: string maxLength: 500 tags: type: array maxItems: 5 items: type: string maxLength: 50 required: [rating] RegisterNotificationDeviceBody: type: object properties: token: { type: string } platform: type: string enum: [ios, android, web] app: type: string enum: [passenger, driver] required: [token, platform, app] # ── Loop Routes ────────────────────────────────────────────────────────── LoopRoute: type: object properties: id: type: integer name: type: string description: type: string nullable: true isActive: type: boolean baseFare: type: number distanceKm: type: number nullable: true routeDurationSeconds: type: integer nullable: true routePolyline: type: string nullable: true distanceSource: type: string nullable: true enum: [google_routes, haversine_fallback] createdAt: type: string format: date-time required: [id, name, isActive, baseFare, createdAt] RoutePoint: type: object properties: lat: type: number lon: type: number required: [lat, lon] PreviewLoopRouteBody: type: object properties: stops: type: array minItems: 2 maxItems: 25 items: $ref: "#/components/schemas/RoutePoint" required: [stops] DrivingRoute: type: object properties: distanceKm: type: number durationSeconds: type: integer nullable: true encodedPolyline: type: string nullable: true source: type: string enum: [google_routes, haversine_fallback] required: [distanceKm, source] DrivingRouteResponse: type: object properties: route: $ref: "#/components/schemas/DrivingRoute" required: [route] TripFarePreviewResponse: type: object properties: route: $ref: "#/components/schemas/DrivingRoute" fareAmount: type: number required: [route, fareAmount] LoopStop: type: object properties: id: type: integer routeId: type: integer name: type: string sequence: type: integer lat: type: number lon: type: number distanceKm: type: number nullable: true etaMinutes: type: integer nullable: true required: [id, routeId, name, sequence, lat, lon] LoopVehicle: type: object properties: id: type: integer routeId: type: integer status: type: string currentLat: type: number nullable: true currentLon: type: number nullable: true updatedAt: type: string format: date-time locationSource: type: string enum: [iot_gps, smartphone_gps] distanceFromUserKm: type: number nullable: true etaFromUserMinutes: type: integer nullable: true required: [id, routeId, status, updatedAt, locationSource] ListLoopRoutesResponse: type: object properties: routes: type: array items: $ref: "#/components/schemas/LoopRoute" required: [routes] LoopRouteDetailResponse: type: object properties: route: $ref: "#/components/schemas/LoopRoute" stops: type: array items: $ref: "#/components/schemas/LoopStop" required: [route, stops] LoopVehiclesResponse: type: object properties: vehicles: type: array items: $ref: "#/components/schemas/LoopVehicle" required: [vehicles] LoopVehicleResponse: type: object properties: vehicle: $ref: "#/components/schemas/LoopVehicle" required: [vehicle] LoopDriverAssignment: type: object properties: id: { type: integer } routeId: { type: integer } driverId: { type: string, format: uuid } driverName: { type: string, nullable: true } plateNumber: { type: string, nullable: true } status: { type: string } updatedAt: { type: string, format: date-time } required: [id, routeId, driverId, status, updatedAt] LoopDriverAssignmentsResponse: type: object properties: assignments: type: array items: $ref: "#/components/schemas/LoopDriverAssignment" required: [assignments] AssignLoopDriverBody: type: object properties: driverId: { type: string, format: uuid } required: [driverId] CreateLoopRouteBody: type: object properties: name: type: string description: type: string baseFare: type: number default: 0 stops: type: array items: type: object properties: name: type: string sequence: type: integer lat: type: number lon: type: number required: [name, sequence, lat, lon] minItems: 2 required: [name, stops] UpdateLoopLocationBody: type: object properties: vehicleId: type: integer lat: type: number lon: type: number currentStopId: type: integer required: [vehicleId, lat, lon] # ── Wallet ─────────────────────────────────────────────────────────────── Wallet: type: object properties: id: type: integer userId: type: string format: uuid balance: type: number updatedAt: type: string format: date-time required: [id, userId, balance, updatedAt] FareTransaction: type: object properties: id: type: integer walletId: type: integer userId: type: string format: uuid amount: type: number type: type: string enum: [top_up, deduct, refund, adjustment] description: type: string nullable: true referenceId: type: string nullable: true balanceBefore: type: number balanceAfter: type: number createdAt: type: string format: date-time required: [id, walletId, userId, amount, type, balanceBefore, balanceAfter, createdAt] WalletResponse: type: object properties: wallet: $ref: "#/components/schemas/Wallet" required: [wallet] ListTransactionsResponse: type: object properties: transactions: type: array items: $ref: "#/components/schemas/FareTransaction" limit: type: integer offset: type: integer required: [transactions, limit, offset] TapBody: type: object properties: cardId: type: string amount: type: number tripId: type: integer idempotencyKey: type: string description: Reader-generated dedup key so a network retry can't double-deduct. required: [cardId, amount, idempotencyKey] TapResponse: type: object properties: ok: type: boolean newBalance: type: number transactionId: type: integer required: [ok, newBalance, transactionId] ListWalletsResponse: type: object properties: wallets: type: array items: $ref: "#/components/schemas/Wallet" limit: type: integer offset: type: integer required: [wallets, limit, offset] # ── Incidents ──────────────────────────────────────────────────────────── IncidentReport: type: object properties: id: type: integer reporterId: type: string format: uuid tripId: type: integer nullable: true type: type: string enum: [accident, flood, fleet_issue] lat: type: number lon: type: number severity: type: string enum: [low, medium, high, critical] description: type: string nullable: true photoUrl: type: string nullable: true status: type: string enum: [open, reviewing, resolved] resolvedAt: type: string format: date-time nullable: true resolvedBy: type: string format: uuid nullable: true createdAt: type: string format: date-time required: [id, reporterId, type, lat, lon, severity, status, createdAt] IncidentResponse: type: object properties: report: $ref: "#/components/schemas/IncidentReport" required: [report] ListIncidentsResponse: type: object properties: reports: type: array items: $ref: "#/components/schemas/IncidentReport" limit: type: integer offset: type: integer required: [reports, limit, offset] CreateIncidentBody: type: object properties: tripId: type: integer type: type: string enum: [accident, flood, fleet_issue] lat: type: number lon: type: number severity: type: string enum: [low, medium, high, critical] description: type: string photoUrl: type: string format: uri required: [type, lat, lon, severity] TrackingTicketResponse: type: object properties: ticket: type: string expiresIn: type: integer description: Ticket lifetime in seconds required: [ticket, expiresIn] FarePolicy: type: object properties: id: type: integer nullable: true name: type: string baseFare: type: number perKmFare: type: number minimumFare: type: number extraPassengerFare: type: number isActive: type: boolean createdBy: type: string format: uuid nullable: true createdAt: type: string format: date-time nullable: true required: [id, name, baseFare, perKmFare, minimumFare, extraPassengerFare, isActive, createdBy, createdAt] FarePolicyResponse: type: object properties: policy: $ref: "#/components/schemas/FarePolicy" required: [policy] UpdateFarePolicyBody: type: object properties: name: type: string minLength: 2 maxLength: 100 baseFare: type: number minimum: 0 perKmFare: type: number minimum: 0 minimumFare: type: number minimum: 0 extraPassengerFare: type: number minimum: 0 required: [name, baseFare, perKmFare, minimumFare, extraPassengerFare] UpdateIncidentBody: type: object properties: status: type: string enum: [reviewing, resolved] required: [status] # ── Analytics ──────────────────────────────────────────────────────────── DailyTripMetric: type: object properties: date: type: string format: date tripCount: type: integer completedCount: type: integer cancelledCount: type: integer uniquePassengers: type: integer totalPassengers: type: integer description: Sum of passenger headcount on completed trips (group bookings count all seats). totalFareCollected: type: number avgTripDurationMinutes: type: number required: [date, tripCount, completedCount, cancelledCount, uniquePassengers, totalPassengers, totalFareCollected, avgTripDurationMinutes] DailyAnalyticsResponse: type: object properties: dailyTrips: type: array items: $ref: "#/components/schemas/DailyTripMetric" startDate: type: string endDate: type: string required: [dailyTrips, startDate, endDate] AnalyticsSummaryResponse: type: object properties: trips: type: object properties: total: type: integer completed: type: integer cancelled: type: integer inProgress: type: integer totalRevenue: type: number required: [total, completed, cancelled, inProgress, totalRevenue] users: type: object properties: totalUsers: type: integer passengers: type: integer drivers: type: integer admins: type: integer required: [totalUsers, passengers, drivers, admins] incidents: type: object properties: total: type: integer open: type: integer accidents: type: integer floods: type: integer required: [total, open, accidents, floods] required: [trips, users, incidents] EarningDay: type: object properties: date: type: string format: date tripCount: type: integer totalEarnings: type: number avgFare: type: number required: [date, tripCount, totalEarnings, avgFare] EarningsResponse: type: object properties: earnings: type: array items: $ref: "#/components/schemas/EarningDay" driverId: type: string startDate: type: string endDate: type: string required: [earnings, driverId, startDate, endDate] # ── Weather ────────────────────────────────────────────────────────────── WeatherResponse: type: object properties: mock: type: boolean location: type: object properties: lat: type: number lon: type: number name: type: string required: [lat, lon] weather: type: object properties: main: type: string description: type: string temp: type: number feelsLike: type: number humidity: type: number windSpeed: type: number icon: type: string required: [main, description, temp, feelsLike, humidity, windSpeed] timestamp: type: string format: date-time required: [mock, location, weather, timestamp] # ── Subscriptions ──────────────────────────────────────────────────────── Subscription: type: object properties: id: type: integer userId: type: string format: uuid plan: type: string status: type: string enum: [active, expired, cancelled] startsAt: type: string format: date-time expiresAt: type: string format: date-time createdAt: type: string format: date-time required: [id, userId, plan, status, startsAt, expiresAt, createdAt] SubscriptionResponse: type: object properties: subscription: $ref: "#/components/schemas/Subscription" required: [subscription] MySubscriptionResponse: type: object properties: subscription: nullable: true allOf: - $ref: "#/components/schemas/Subscription" required: [subscription] ListSubscriptionsResponse: type: object properties: subscriptions: type: array items: $ref: "#/components/schemas/Subscription" limit: type: integer offset: type: integer required: [subscriptions, limit, offset] CreateSubscriptionBody: type: object properties: userId: type: string format: uuid plan: type: string default: annual startsAt: type: string format: date-time expiresAt: type: string format: date-time required: [userId] UpdateSubscriptionBody: type: object properties: status: type: string enum: [active, expired, cancelled] required: [status]