{
  "openapi": "3.0.4",
  "info": {
    "title": "UnityTrip Approver API",
    "description": "Open approvals for a given approver, each tied to a claim and a booking with a deadline. For business bookings, no payment executes without an approved claim number. Prototype-derived reference spec: servers and authentication are intentionally omitted.",
    "version": "prototype-v1",
    "contact": {
      "name": "UnityTrip",
      "url": "https://unitytrip.com"
    }
  },
  "paths": {
    "/api/Approvals/{emailOrEmployeeId}": {
      "get": {
        "tags": [
          "Approvals"
        ],
        "summary": "Retrieves all open approvals for a specific approver",
        "description": "Sample request:\n            \n    GET /api/approvals/john.doe@company.com\n    X-API-KEY: your-api-key-here\n            \nOr using employee ID:\n            \n    GET /api/approvals/12345\n    X-API-KEY: your-api-key-here",
        "parameters": [
          {
            "name": "emailOrEmployeeId",
            "in": "path",
            "description": "The approver's email address or employee ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the list of pending approvals for the approver",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApprovalSummary"
                  }
                }
              }
            }
          },
          "401": {
            "description": "If the API key is invalid or missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "If the approver cannot be found by the provided email or employee ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApprovalSummary": {
        "type": "object",
        "properties": {
          "claimId": {
            "type": "string",
            "description": "Unique identifier for the claim",
            "format": "uuid",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
          },
          "claimNumber": {
            "type": "string",
            "description": "Human-readable claim reference number",
            "nullable": true,
            "example": "CLM-2026-00123"
          },
          "bookingReference": {
            "type": "string",
            "description": "Human-readable booking reference associated with the claim",
            "nullable": true,
            "example": 5000123
          },
          "createdAt": {
            "type": "string",
            "description": "Timestamp when the claim was created",
            "format": "date-time",
            "example": "2026-01-15T10:30:00Z"
          },
          "sequenceNumber": {
            "type": "integer",
            "description": "The approval sequence position for this approver in the claim's approval chain",
            "format": "int32",
            "example": 1
          },
          "status": {
            "$ref": "#/components/schemas/ClaimStatus"
          },
          "approvalTimeLimit": {
            "type": "string",
            "description": "The time limit within which the approver must respond",
            "format": "date-span",
            "nullable": true,
            "example": "P3D"
          },
          "approvalDeadline": {
            "type": "string",
            "description": "The absolute deadline by which the approver must respond",
            "format": "date-time",
            "nullable": true,
            "example": "2026-01-18T10:30:00Z"
          },
          "requester": {
            "$ref": "#/components/schemas/BookingPersonInfo"
          },
          "requestTitle": {
            "type": "string",
            "description": "A descriptive title for the approval request",
            "nullable": true,
            "example": "Business (Client Meeting in Berlin)"
          },
          "requestDescription": {
            "type": "string",
            "description": "Detailed description of the claim's financial allocation",
            "nullable": true,
            "example": "CC-12345 - FND-67890 (Cost Centre - Fund)"
          },
          "link": {
            "type": "string",
            "description": "Direct URL to view the full claim details",
            "nullable": true,
            "example": "https://approvals.unitytrip.app/claims/3fa85f64-5717-4562-b3fc-2c963f66afa6"
          }
        },
        "additionalProperties": false,
        "description": "Summary information for a claim pending approval"
      },
      "BookingPersonInfo": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "nullable": true
          },
          "firstname": {
            "type": "string",
            "nullable": true
          },
          "lastname": {
            "type": "string",
            "nullable": true
          },
          "displayname": {
            "type": "string",
            "nullable": true
          },
          "normalizedSearchValue": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "employeeId": {
            "type": "string",
            "nullable": true
          },
          "employeeLevel": {
            "type": "string",
            "nullable": true
          },
          "division": {
            "type": "string",
            "nullable": true
          },
          "department": {
            "type": "string",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "nullable": true
          },
          "passengerType": {
            "type": "string",
            "nullable": true
          },
          "subPassengerType": {
            "$ref": "#/components/schemas/SubPassengerTypes"
          },
          "locationId": {
            "type": "string",
            "nullable": true
          },
          "policyGroupId": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "ClaimStatus": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5
        ],
        "type": "integer",
        "format": "int32"
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "SubPassengerTypes": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      }
    }
  },
  "tags": [
    {
      "name": "Approvals"
    }
  ]
}