{
  "openapi": "3.1.0",
  "info": {
    "title": "GhanaAPI",
    "version": "1.0.0",
    "description": "Developer data API for Ghana: phone/carrier validation, banks, public holidays, regions."
  },
  "servers": [{ "url": "https://ghanaapi.sintim-koree.com/api" }],
  "paths": {
    "/v1/phone/validate": {
      "get": {
        "summary": "Validate a Ghanaian phone number",
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": true,
            "schema": { "type": "string" },
            "example": "0244123456"
          }
        ],
        "responses": {
          "200": {
            "description": "Validation result (valid:false for unparseable input)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "input": { "type": "string" },
                    "valid": { "type": "boolean" },
                    "e164": { "type": ["string", "null"] },
                    "local": { "type": ["string", "null"] },
                    "carrier": { "type": ["string", "null"] },
                    "momoCapable": { "type": "boolean" },
                    "type": { "type": ["string", "null"], "enum": ["mobile", "landline", null] },
                    "portabilityNote": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/v1/banks": {
      "get": {
        "summary": "List Ghanaian banks",
        "responses": {
          "200": {
            "description": "Bank list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "integer" },
                    "banks": { "type": "array", "items": { "$ref": "#/components/schemas/Bank" } }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/banks/{code}": {
      "get": {
        "summary": "Look up a bank by code or SWIFT",
        "parameters": [
          { "name": "code", "in": "path", "required": true, "schema": { "type": "string" }, "example": "040" }
        ],
        "responses": {
          "200": {
            "description": "Bank",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Bank" } } }
          },
          "404": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/v1/holidays/{year}": {
      "get": {
        "summary": "Public holidays for a year",
        "parameters": [
          { "name": "year", "in": "path", "required": true, "schema": { "type": "integer" }, "example": 2026 }
        ],
        "responses": {
          "200": {
            "description": "Holidays",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "year": { "type": "integer" },
                    "holidays": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": { "type": "string", "format": "date" },
                          "name": { "type": "string" },
                          "type": { "type": "string" },
                          "tentative": { "type": "boolean" }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/v1/regions": {
      "get": {
        "summary": "The 16 regions of Ghana",
        "responses": {
          "200": {
            "description": "Regions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "integer" },
                    "regions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": { "type": "string" },
                          "capital": { "type": "string" },
                          "code": { "type": "string" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Bank": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "bankCode": { "type": "string" },
          "swift": { "type": "string" },
          "type": { "type": "string", "enum": ["commercial", "rural", "savings"] }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Standard error envelope",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "object",
                  "properties": {
                    "code": { "type": "string" },
                    "message": { "type": "string" },
                    "status": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
