openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: SecurityRide School Bus Tracking API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: buses description: Bus management - name: students description: Student management - name: notifications description: Notification management - name: dashboard description: Dashboard summaries paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/login: post: operationId: login tags: [auth] summary: Login as admin or parent requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginBody" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/LoginResponse" "401": description: Invalid credentials /auth/me: get: operationId: getMe tags: [auth] summary: Get current user info responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/User" "401": description: Not authenticated /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out /buses: get: operationId: listBuses tags: [buses] summary: List all buses responses: "200": description: List of buses content: application/json: schema: type: array items: $ref: "#/components/schemas/Bus" post: operationId: createBus tags: [buses] summary: Create a new bus (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateBusBody" responses: "201": description: Bus created content: application/json: schema: $ref: "#/components/schemas/Bus" /buses/{busId}: get: operationId: getBus tags: [buses] summary: Get bus details parameters: - name: busId in: path required: true schema: type: integer responses: "200": description: Bus details content: application/json: schema: $ref: "#/components/schemas/Bus" /buses/{busId}/pickup: post: operationId: markPickup tags: [buses] summary: Mark student as picked up parameters: - name: busId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PickupDropoffBody" responses: "200": description: Pickup recorded content: application/json: schema: $ref: "#/components/schemas/TripEvent" /buses/{busId}/dropoff: post: operationId: markDropoff tags: [buses] summary: Mark student as dropped off parameters: - name: busId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PickupDropoffBody" responses: "200": description: Dropoff recorded content: application/json: schema: $ref: "#/components/schemas/TripEvent" /students: get: operationId: listStudents tags: [students] summary: List students parameters: - name: search in: query schema: type: string - name: parentId in: query schema: type: integer responses: "200": description: List of students content: application/json: schema: type: array items: $ref: "#/components/schemas/Student" post: operationId: createStudent tags: [students] summary: Create student (admin only) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateStudentBody" responses: "201": description: Student created content: application/json: schema: $ref: "#/components/schemas/Student" /students/{studentId}: get: operationId: getStudent tags: [students] summary: Get student details with bus status parameters: - name: studentId in: path required: true schema: type: integer responses: "200": description: Student details content: application/json: schema: $ref: "#/components/schemas/StudentDetail" /students/{studentId}/status: get: operationId: getStudentStatus tags: [students] summary: Get current bus status for a student parameters: - name: studentId in: path required: true schema: type: integer responses: "200": description: Student bus status content: application/json: schema: $ref: "#/components/schemas/StudentBusStatus" /notifications: get: operationId: listNotifications tags: [notifications] summary: List notifications for current user responses: "200": description: List of notifications content: application/json: schema: type: array items: $ref: "#/components/schemas/Notification" /notifications/unread-count: get: operationId: getUnreadCount tags: [notifications] summary: Get count of unread notifications responses: "200": description: Unread count content: application/json: schema: $ref: "#/components/schemas/UnreadCount" /dashboard/summary: get: operationId: getDashboardSummary tags: [dashboard] summary: Get dashboard summary (admin) responses: "200": description: Dashboard data content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /dashboard/recent-activity: get: operationId: getRecentActivity tags: [dashboard] summary: Get recent pickup/dropoff activity responses: "200": description: Recent activity content: application/json: schema: type: array items: $ref: "#/components/schemas/ActivityItem" components: schemas: HealthStatus: type: object properties: status: type: string required: - status LoginBody: type: object properties: username: type: string password: type: string role: type: string enum: [admin, parent] required: - username - password - role LoginResponse: type: object properties: user: $ref: "#/components/schemas/User" message: type: string required: - user - message User: type: object properties: id: type: integer username: type: string role: type: string enum: [admin, parent] fullName: type: string required: - id - username - role - fullName Bus: type: object properties: id: type: integer busNumber: type: string driverName: type: string route: type: string stops: type: array items: $ref: "#/components/schemas/BusStop" capacity: type: integer currentStudentCount: type: integer status: type: string enum: [idle, in_transit, completed] required: - id - busNumber - driverName - route - stops - capacity - currentStudentCount - status BusStop: type: object properties: id: type: integer name: type: string lat: type: number lng: type: number order: type: integer required: - id - name - lat - lng - order CreateBusBody: type: object properties: busNumber: type: string driverName: type: string route: type: string capacity: type: integer required: - busNumber - driverName - route - capacity Student: type: object properties: id: type: integer name: type: string grade: type: string parentId: type: integer parentName: type: string busId: type: integer busNumber: type: string stopName: type: string required: - id - name - grade - parentId - parentName - busId - busNumber - stopName CreateStudentBody: type: object properties: name: type: string grade: type: string parentId: type: integer busId: type: integer stopName: type: string required: - name - grade - parentId - busId - stopName StudentDetail: type: object properties: id: type: integer name: type: string grade: type: string parentName: type: string busNumber: type: string stopName: type: string status: type: string enum: [waiting, on_bus, dropped_off] lastEvent: $ref: "#/components/schemas/TripEvent" required: - id - name - grade - parentName - busNumber - stopName - status StudentBusStatus: type: object properties: studentId: type: integer studentName: type: string isOnBus: type: boolean busNumber: type: string lastPickupTime: type: string lastPickupLocation: type: string lastDropoffTime: type: string lastDropoffLocation: type: string required: - studentId - studentName - isOnBus - busNumber PickupDropoffBody: type: object properties: studentId: type: integer location: type: string required: - studentId - location TripEvent: type: object properties: id: type: integer studentId: type: integer studentName: type: string busId: type: integer eventType: type: string enum: [pickup, dropoff] location: type: string timestamp: type: string required: - id - studentId - studentName - busId - eventType - location - timestamp Notification: type: object properties: id: type: integer parentId: type: integer studentName: type: string message: type: string eventType: type: string enum: [pickup, dropoff] timestamp: type: string read: type: boolean required: - id - parentId - studentName - message - eventType - timestamp - read UnreadCount: type: object properties: count: type: integer required: - count DashboardSummary: type: object properties: totalBuses: type: integer activeBuses: type: integer totalStudents: type: integer studentsOnBus: type: integer studentsDroppedOff: type: integer totalParents: type: integer required: - totalBuses - activeBuses - totalStudents - studentsOnBus - studentsDroppedOff - totalParents ActivityItem: type: object properties: id: type: integer studentName: type: string busNumber: type: string eventType: type: string enum: [pickup, dropoff] location: type: string timestamp: type: string required: - id - studentName - busNumber - eventType - location - timestamp