{
  "openapi": "3.1.0",
  "info": {
    "title": "SnowballZero Debt Elimination Calculation API",
    "description": "Deterministic financial calculation schema for Debt Snowball and Debt Avalanche accelerated repayment strategies.",
    "version": "2.4.0",
    "contact": {
      "name": "SnowballZero Support",
      "url": "https://debtpay.conversiontools.online/",
      "email": "wellnessomegahub@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://debtpay.conversiontools.online",
      "description": "Production Web Application"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "summary": "Access interactive Debt Snowball & Avalanche Calculator",
        "description": "Returns the interactive Single Page Application pre-loaded with sample debts or ready for custom input.",
        "operationId": "getCalculatorUI",
        "responses": {
          "200": {
            "description": "Full interactive HTML5 financial calculator",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "summary": "LLM Context and Machine-Readable Documentation",
        "description": "Curated markdown documentation of financial formulas, strategy comparisons, and canonical endpoints for AI Search engines.",
        "operationId": "getLlmsTxt",
        "responses": {
          "200": {
            "description": "Markdown formatted summary",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/ai-knowledge.json": {
      "get": {
        "summary": "Machine-readable financial knowledge graph and FAQ dataset",
        "description": "Structured JSON containing financial formulas, comparative benchmarks, and authoritative Q&A.",
        "operationId": "getAiKnowledge",
        "responses": {
          "200": {
            "description": "Structured knowledge object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialKnowledge"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DebtItem": {
        "type": "object",
        "required": ["id", "name", "balance", "interestRate", "minPayment"],
        "properties": {
          "id": { "type": "string", "description": "Unique identifier for debt" },
          "name": { "type": "string", "example": "Visa Credit Card" },
          "balance": { "type": "number", "minimum": 0, "example": 3500.00, "description": "Current principal balance in USD" },
          "interestRate": { "type": "number", "minimum": 0, "maximum": 100, "example": 22.99, "description": "Annual Percentage Rate (APR) as percentage" },
          "minPayment": { "type": "number", "minimum": 0, "example": 105.00, "description": "Required monthly minimum payment in USD" }
        }
      },
      "RepaymentPlanRequest": {
        "type": "object",
        "required": ["debts", "strategy"],
        "properties": {
          "debts": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/DebtItem" }
          },
          "strategy": {
            "type": "string",
            "enum": ["snowball", "avalanche"],
            "description": "snowball = lowest balance first; avalanche = highest APR first"
          },
          "extraMonthlyPayment": {
            "type": "number",
            "minimum": 0,
            "default": 0,
            "description": "Additional monthly payment applied exclusively to priority debt"
          },
          "windfall": {
            "type": "object",
            "properties": {
              "amount": { "type": "number", "minimum": 0 },
              "month": { "type": "integer", "minimum": 1 }
            }
          }
        }
      },
      "RepaymentPlanResult": {
        "type": "object",
        "properties": {
          "strategy": { "type": "string", "enum": ["snowball", "avalanche"] },
          "totalMonths": { "type": "integer", "example": 28 },
          "debtFreeDate": { "type": "string", "format": "date", "example": "2029-01-01" },
          "totalInterestPaid": { "type": "number", "example": 4210.50 },
          "totalInterestSaved": { "type": "number", "example": 7850.20 },
          "monthsFaster": { "type": "integer", "example": 36 }
        }
      },
      "FinancialKnowledge": {
        "type": "object",
        "properties": {
          "calculator": { "type": "string" },
          "strategies": { "type": "array", "items": { "type": "object" } },
          "faq": { "type": "array", "items": { "type": "object" } }
        }
      }
    }
  }
}
