{
  "openapi": "3.1.0",
  "info": {
    "title": "Agentic reference ticket service",
    "version": "0.1.0"
  },
  "paths": {
    "/tickets": {
      "post": {
        "operationId": "createTicket",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "subject"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Same original result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "request_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "subject": {
                      "type": "string",
                      "minLength": 1
                    },
                    "status": {
                      "enum": [
                        "open",
                        "closed"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "request_id",
                    "subject",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Created and recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "request_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "subject": {
                      "type": "string",
                      "minLength": 1
                    },
                    "status": {
                      "enum": [
                        "open",
                        "closed"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "request_id",
                    "subject",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Key already bound to different input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/requests/{requestId}": {
      "get": {
        "operationId": "getRequestStatus",
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Request outcome; unknown is not absence proof",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "status": {
                      "enum": [
                        "succeeded",
                        "failed",
                        "pending",
                        "unknown"
                      ]
                    },
                    "resource_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "status",
                    "resource_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/tickets/{ticketId}": {
      "get": {
        "operationId": "getTicket",
        "parameters": [
          {
            "name": "ticketId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Persisted ticket",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "request_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "subject": {
                      "type": "string",
                      "minLength": 1
                    },
                    "status": {
                      "enum": [
                        "open",
                        "closed"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "request_id",
                    "subject",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Resource is not currently visible"
          }
        }
      }
    }
  }
}
