{
  "openapi": "3.1.0",
  "info": {
    "title": "The Apostolic Church-Ghana | Afrancho Central Assembly API",
    "description": "Official programmatic and agent API for The Apostolic Church-Ghana | Afrancho Central Assembly in Kumasi. Provides sermon transcripts, daily devotionals, Sunday Order of Service bulletins, and prayer requests.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://www.tac-ghafranchocentral.org/api",
      "description": "Production Server"
    },
    {
      "url": "https://www.tac-ghafranchocentral.org/api/sandbox",
      "description": "Sandbox Environment (Test Mode)"
    }
  ],
  "paths": {
    "/daily-devotionals": {
      "get": {
        "operationId": "getDailyDevotionals",
        "summary": "Retrieve latest daily devotionals",
        "description": "Fetches a list of recent daily devotionals and scripture reflections.",
        "responses": {
          "200": {
            "description": "List of devotionals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Devotional"
                      }
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/404NotFound"
          },
          "429": {
            "$ref": "#/components/responses/429TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/500InternalError"
          }
        }
      }
    },
    "/prayer-request": {
      "post": {
        "operationId": "submitPrayerRequest",
        "summary": "Submit a prayer request",
        "description": "Submits a prayer request directly to the church pastoral team.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Unique key to prevent duplicate prayer submissions upon client retry."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrayerRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prayer request received successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/401Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/429TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/500InternalError"
          }
        }
      }
    },
    "/soos/latest": {
      "get": {
        "operationId": "getLatestSundayOrderOfService",
        "summary": "Get active Sunday Order of Service bulletin",
        "description": "Fetches the latest Sunday bulletin with scripture texts, preacher, and hymn numbers.",
        "responses": {
          "200": {
            "description": "Sunday bulletin details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SundayOrderOfService"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/404NotFound"
          },
          "429": {
            "$ref": "#/components/responses/429TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/500InternalError"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ProblemDetails": {
        "type": "object",
        "description": "RFC 9457 Problem Details error response object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "URI reference that identifies the problem type"
          },
          "title": {
            "type": "string",
            "description": "Short human-readable summary of the problem type"
          },
          "status": {
            "type": "integer",
            "description": "HTTP status code generated by the origin server"
          },
          "detail": {
            "type": "string",
            "description": "Human-readable explanation specific to this occurrence"
          },
          "instance": {
            "type": "string",
            "description": "URI reference that identifies the specific occurrence"
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code for automated agent handling"
          },
          "hint": {
            "type": "string",
            "description": "Resolution suggestion or documentation link"
          }
        }
      },
      "Devotional": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "scripture": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "SundayOrderOfService": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "service_date": {
            "type": "string",
            "format": "date"
          },
          "preacher": {
            "type": "string"
          },
          "theme": {
            "type": "string"
          },
          "scripture_readings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "hymns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PrayerRequestInput": {
        "type": "object",
        "required": [
          "name",
          "request"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string"
          },
          "request": {
            "type": "string"
          },
          "isPrivate": {
            "type": "boolean"
          }
        }
      }
    },
    "responses": {
      "400BadRequest": {
        "description": "Bad Request — Input validation failure",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "401Unauthorized": {
        "description": "Unauthorized — Authentication required via auth.md",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            },
            "description": "Bearer resource_metadata challenge"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "403Forbidden": {
        "description": "Forbidden — Insufficient scope permissions",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "404NotFound": {
        "description": "Not Found — The requested resource does not exist",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "429TooManyRequests": {
        "description": "Too Many Requests — Rate limit exceeded",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Wait duration in seconds"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "500InternalError": {
        "description": "Internal Server Error",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      }
    }
  }
}