{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/audiopod-ai/json-schema/audiopod-ai-credit-info-schema.json",
  "title": "CreditInfo",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/audiopod-ai-credits-api-openapi.yml#/components/schemas/CreditInfo",
  "properties": {
    "credits_balance": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Credits Balance"
    },
    "payg_balance": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Payg Balance",
      "default": 0
    },
    "total_available_credits": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Total Available Credits"
    },
    "last_reset_at": {
      "type": "string",
      "format": "date-time",
      "title": "Last Reset At"
    },
    "total_credits_used": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Total Credits Used"
    },
    "total_payg_credits_purchased": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Total Payg Credits Purchased",
      "default": 0
    },
    "next_reset_date": {
      "type": "string",
      "format": "date-time",
      "title": "Next Reset Date"
    },
    "credits_per_month": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Credits Per Month"
    },
    "cycle_allotment": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Cycle Allotment"
    },
    "rolled_over": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Rolled Over",
      "default": 0
    },
    "held_until": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Held Until"
    },
    "auto_refill_state": {
      "anyOf": [
        {
          "$ref": "#/$defs/AutoRefillState"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "credits_balance",
    "total_available_credits",
    "last_reset_at",
    "total_credits_used",
    "next_reset_date",
    "credits_per_month"
  ],
  "$defs": {
    "AutoRefillState": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "default": false
        },
        "target": {
          "type": "string",
          "const": "payg",
          "title": "Target",
          "default": "payg"
        },
        "threshold_credits": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Threshold Credits"
        },
        "last_attempt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Attempt"
        }
      },
      "type": "object",
      "title": "AutoRefillState",
      "description": "Status of automatic credit top-up for this account."
    }
  }
}