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: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: bookings description: Booking operations - name: openai description: OpenAI AI chat operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /bookings: post: operationId: createBooking tags: [bookings] summary: Create a new booking requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateBookingBody" responses: "201": description: Booking created content: application/json: schema: $ref: "#/components/schemas/Booking" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" get: operationId: listBookings tags: [bookings] summary: List all bookings responses: "200": description: List of bookings content: application/json: schema: type: array items: $ref: "#/components/schemas/Booking" /bookings/stats: get: operationId: getBookingStats tags: [bookings] summary: Get booking statistics responses: "200": description: Booking stats content: application/json: schema: $ref: "#/components/schemas/BookingStats" /openai/conversations: get: operationId: listOpenaiConversations tags: [openai] summary: List all conversations responses: "200": description: List of conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiConversation" post: operationId: createOpenaiConversation tags: [openai] summary: Create a new conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOpenaiConversationBody" responses: "201": description: Created conversation content: application/json: schema: $ref: "#/components/schemas/OpenaiConversation" /openai/conversations/{id}: get: operationId: getOpenaiConversation tags: [openai] summary: Get conversation with messages parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation with messages content: application/json: schema: $ref: "#/components/schemas/OpenaiConversationWithMessages" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" delete: operationId: deleteOpenaiConversation tags: [openai] summary: Delete a conversation parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" /openai/conversations/{id}/messages: get: operationId: listOpenaiMessages tags: [openai] summary: List messages in a conversation parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of messages content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiMessage" post: operationId: sendOpenaiMessage tags: [openai] summary: Send a text message and receive a streaming text response parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendOpenaiMessageBody" responses: "200": description: SSE stream of assistant text chunks content: text/event-stream: {} components: schemas: HealthStatus: type: object properties: status: type: string required: - status CreateBookingBody: type: object properties: name: type: string minLength: 1 phone: type: string minLength: 10 service: type: string enum: - Mobile Repair - Laptop Repair - Screen Replacement - Battery Replacement - Back Glass Replacement - Charging Port Repair - Water Damage Repair - Tablet Repair - Smartwatch Repair - Android Repair - iPhone Repair problem: type: string minLength: 1 address: type: string minLength: 1 zipcode: type: string minLength: 6 maxLength: 6 device_brand: type: string device_model: type: string city: type: string preferred_date: type: string consent_accepted: type: boolean required: - name - phone - service - problem - address - zipcode - consent_accepted Booking: type: object properties: id: type: integer name: type: string phone: type: string service: type: string problem: type: string address: type: string zipcode: type: string device_brand: type: string device_model: type: string city: type: string preferred_date: type: string consent_accepted: type: boolean status: type: string enum: [pending, confirmed, completed, cancelled] createdAt: type: string format: date-time required: - id - name - phone - service - problem - address - status - consent_accepted - createdAt BookingStats: type: object properties: total: type: integer pending: type: integer confirmed: type: integer completed: type: integer byService: type: object additionalProperties: type: integer required: - total - pending - confirmed - completed - byService ErrorResponse: type: object properties: message: type: string errors: type: array items: type: string required: - message OpenaiConversation: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time required: - id - title - createdAt OpenaiMessage: type: object properties: id: type: integer conversationId: type: integer role: type: string content: type: string createdAt: type: string format: date-time required: - id - conversationId - role - content - createdAt CreateOpenaiConversationBody: type: object properties: title: type: string required: - title SendOpenaiMessageBody: type: object properties: content: type: string required: - content OpenaiConversationWithMessages: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time messages: type: array items: $ref: "#/components/schemas/OpenaiMessage" required: - id - title - createdAt - messages OpenaiError: type: object properties: error: type: string required: - error