{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://happydebits.com/ledger.schema.json",
  "title": "Happydebits ledger",
  "$comment": "Use /ledger-action.schema.json for reviewable agent change proposals. This schema remains the full export format.",
  "type": "object",
  "required": ["version", "currency", "subscriptions"],
  "properties": {
    "version": { "const": 2 },
    "currency": { "enum": ["USD", "EUR", "GBP", "INR", "CAD", "AUD"] },
    "subscriptions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "amount", "interval"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "amount": { "type": "number" },
          "currency": { "enum": ["USD", "EUR", "GBP", "INR", "CAD", "AUD"] },
          "interval": { "enum": ["weekly", "monthly", "quarterly", "yearly"] },
          "category": {
            "enum": [
              "entertainment",
              "software",
              "utilities",
              "health",
              "news",
              "shopping",
              "finance",
              "other"
            ]
          },
          "nextBillingDate": { "type": ["string", "null"] },
          "status": { "enum": ["active", "paused", "cancelled"] },
          "notes": { "type": "string" },
          "paymentMethod": { "type": "string" },
          "priceHistory": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["date", "amount"],
              "properties": {
                "date": { "type": "string" },
                "amount": { "type": "number" }
              }
            }
          }
        }
      }
    }
  }
}
