{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cayra-io/json-schema/cayra-io-billing-response-schema.json",
  "title": "BillingResponse",
  "description": "Billing representation",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cayra-io-openapi.json#/components/schemas/BillingResponse",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "company_id": {
      "type": "string",
      "format": "uuid",
      "title": "Company Id"
    },
    "license_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "License Id"
    },
    "billing_code": {
      "type": "string",
      "title": "Billing Code"
    },
    "billing_type": {
      "$ref": "#/$defs/BillingTypeEnum"
    },
    "status": {
      "$ref": "#/$defs/BillingStatusEnum"
    },
    "amount": {
      "type": "number",
      "title": "Amount"
    },
    "currency": {
      "type": "string",
      "title": "Currency"
    },
    "tax_amount": {
      "type": "number",
      "title": "Tax Amount"
    },
    "total_amount": {
      "type": "number",
      "title": "Total Amount"
    },
    "payment_provider": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Payment Provider"
    },
    "provider_reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Provider Reference"
    },
    "metadata": {
      "type": "object",
      "title": "Metadata"
    },
    "notes": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Notes"
    },
    "issued_at": {
      "type": "string",
      "format": "date-time",
      "title": "Issued At"
    },
    "due_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Due At"
    },
    "paid_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Paid At"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Canceled At"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    }
  },
  "type": "object",
  "required": [
    "id",
    "company_id",
    "license_id",
    "billing_code",
    "billing_type",
    "status",
    "amount",
    "currency",
    "tax_amount",
    "total_amount",
    "payment_provider",
    "provider_reference",
    "metadata",
    "notes",
    "issued_at",
    "due_at",
    "paid_at",
    "canceled_at",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "BillingStatusEnum": {
      "type": "string",
      "enum": [
        "draft",
        "pending",
        "paid",
        "failed",
        "cancelled",
        "refunded"
      ],
      "title": "BillingStatusEnum"
    },
    "BillingTypeEnum": {
      "type": "string",
      "enum": [
        "prepaid_tokens",
        "onprem_license"
      ],
      "title": "BillingTypeEnum"
    }
  }
}