{"openapi":"3.1.0","info":{"title":"AI Support Ticket System API","description":"Ticket management API and web dashboard.","version":"1.0.0"},"paths":{"/api/tickets":{"get":{"tags":["tickets"],"summary":"Get Tickets","description":"List tickets with optional inclusive date filters and pagination.\n\nRaises:\n    HTTPException: If the date range starts after it ends.","operationId":"getTickets","parameters":[{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date To"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TicketResponse"},"title":"Response Gettickets"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tickets"],"summary":"Post Ticket","description":"Analyze submitted email text and create a persisted ticket.\n\nArgs:\n    request: Validated ticket creation payload.\n\nRaises:\n    HTTPException: With status 503 if ticket processing fails.","operationId":"postTickets","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTicketRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tickets/{ticket_id}":{"get":{"tags":["tickets"],"summary":"Get Ticket","description":"Return full ticket details by ID or report that it does not exist.\n\nArgs:\n    ticket_id: Identifier of the requested ticket.\n\nRaises:\n    HTTPException: With status 404 if the ticket does not exist.","operationId":"getTicketByID","parameters":[{"name":"ticket_id","in":"path","required":true,"schema":{"type":"integer","title":"Ticket Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tickets/{ticket_id}/status":{"patch":{"tags":["tickets"],"summary":"Patch Ticket Status","description":"Update a ticket's workflow status.\n\nArgs:\n    ticket_id: Identifier of the ticket to update.\n    request: Validated target status.\n\nRaises:\n    HTTPException: With status 404 if the ticket does not exist.","operationId":"updateTicketStatus","parameters":[{"name":"ticket_id","in":"path","required":true,"schema":{"type":"integer","title":"Ticket Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTicketStatusRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"tags":["health"],"summary":"Health","description":"Return the API process health status.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Health Get"}}}}}}}},"components":{"schemas":{"CreateTicketRequest":{"properties":{"email_content":{"type":"string","maxLength":30000,"minLength":1,"title":"Email Content"}},"type":"object","required":["email_content"],"title":"CreateTicketRequest","description":"Validate text submitted to create and analyze a support ticket."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"TicketDetailResponse":{"properties":{"id":{"type":"integer","title":"Id"},"customer_id":{"type":"string","title":"Customer Id"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"issue_summary":{"type":"string","title":"Issue Summary"},"urgency":{"type":"string","title":"Urgency"},"database_status":{"type":"string","title":"Database Status"},"action_required":{"type":"string","title":"Action Required"},"status":{"$ref":"#/components/schemas/TicketStatus"},"processed_at":{"type":"string","title":"Processed At"},"raw_email_content":{"type":"string","title":"Raw Email Content"}},"type":"object","required":["id","customer_id","company_name","issue_summary","urgency","database_status","action_required","status","processed_at","raw_email_content"],"title":"TicketDetailResponse","description":"Full ticket representation returned by the detail endpoint."},"TicketResponse":{"properties":{"id":{"type":"integer","title":"Id"},"customer_id":{"type":"string","title":"Customer Id"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"issue_summary":{"type":"string","title":"Issue Summary"},"urgency":{"type":"string","title":"Urgency"},"database_status":{"type":"string","title":"Database Status"},"action_required":{"type":"string","title":"Action Required"},"status":{"$ref":"#/components/schemas/TicketStatus"},"processed_at":{"type":"string","title":"Processed At"}},"type":"object","required":["id","customer_id","company_name","issue_summary","urgency","database_status","action_required","status","processed_at"],"title":"TicketResponse","description":"Ticket fields returned by creation and list endpoints."},"TicketStatus":{"type":"string","enum":["new","in_progress","done","rejected"],"title":"TicketStatus","description":"Supported ticket workflow states stored in PostgreSQL."},"TicketStatusResponse":{"properties":{"id":{"type":"integer","title":"Id"},"status":{"$ref":"#/components/schemas/TicketStatus"}},"type":"object","required":["id","status"],"title":"TicketStatusResponse","description":"Response containing a ticket identifier and its updated status."},"UpdateTicketStatusRequest":{"properties":{"status":{"$ref":"#/components/schemas/TicketStatus"}},"type":"object","required":["status"],"title":"UpdateTicketStatusRequest","description":"Validate a requested ticket workflow status change."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}