{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rial-io/json-schema/rial-io-credits-schema.json",
  "title": "Credits",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rial-io-openapi.json#/components/schemas/Credits",
  "type": "object",
  "properties": {
    "balance_cents": {
      "type": "integer"
    },
    "photos_available": {
      "type": "integer",
      "minimum": 0
    },
    "price_per_photo_cents": {
      "type": "integer"
    },
    "packs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "photos": {
            "type": "integer"
          },
          "amount_cents": {
            "type": "integer"
          }
        },
        "required": [
          "photos",
          "amount_cents"
        ]
      }
    },
    "payment_method": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "brand": {
          "type": "string"
        },
        "last4": {
          "type": "string"
        }
      }
    },
    "monthly_cap_cents": {
      "type": [
        "integer",
        "null"
      ]
    },
    "month_spent_cents": {
      "type": "integer"
    },
    "plan": {
      "type": "object",
      "properties": {
        "tier": {
          "type": "string",
          "enum": [
            "free",
            "pro",
            "enterprise"
          ]
        },
        "photos_included": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Photos the plan includes this period; null when unlimited."
        },
        "photos_used": {
          "type": "integer",
          "minimum": 0
        },
        "photos_left": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "renews_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "When the included photos renew; null when the plan includes nothing now."
        }
      },
      "required": [
        "tier",
        "photos_included",
        "photos_used",
        "photos_left",
        "renews_at"
      ],
      "description": "The photos the plan includes, used before any credit."
    },
    "photos_left": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Photos the account can still capture: free ones left plus what the credits buy. null when the account has no capture limit."
    }
  },
  "required": [
    "balance_cents",
    "photos_available",
    "price_per_photo_cents",
    "packs",
    "payment_method",
    "monthly_cap_cents",
    "month_spent_cents",
    "plan",
    "photos_left"
  ]
}