{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kodshop-cloud/json-schema/kodshop-cloud-product-detail-schema.json",
  "title": "ProductDetail",
  "x-generated": "2026-11-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kodshop-cloud-openapi.json#/components/schemas/ProductDetail",
  "allOf": [
    {
      "$ref": "#/$defs/ProductSummary"
    },
    {
      "properties": {
        "content": {
          "description": "Description / instructions / terms",
          "type": "object"
        },
        "fields": {
          "description": "Per-product input requirements (e.g. account_number for top-ups).",
          "items": {
            "type": "object"
          },
          "type": "array"
        },
        "items": {
          "items": {
            "$ref": "#/$defs/Item"
          },
          "type": "array"
        }
      },
      "type": "object"
    }
  ],
  "$defs": {
    "Item": {
      "description": "One buyable denomination.",
      "properties": {
        "currency": {
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "in_stock": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "price": {
          "description": "Price of this denomination, in currency",
          "type": "number"
        },
        "price_rub": {
          "description": "Legacy alias of price — see ProductSummary.min_price_rub",
          "type": "number"
        },
        "restricted_countries": {
          "description": "ISO-2 codes where this code cannot be redeemed. Omitted entirely when there are no restrictions — treat an absent key as an empty list.",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "ProductSummary": {
      "properties": {
        "available_for_sale": {
          "type": "boolean"
        },
        "brand": {
          "type": [
            "string",
            "null"
          ]
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency": {
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "in_stock": {
          "type": "boolean"
        },
        "in_stock_count": {
          "description": "Units left. Absent when the count is unknown but the product is available.",
          "type": "integer"
        },
        "items_count": {
          "type": "integer"
        },
        "min_price": {
          "description": "Cheapest denomination, in currency",
          "type": "number"
        },
        "min_price_rub": {
          "description": "Legacy alias of min_price. Same number, same currency — the _rub suffix is a storage-era name, not a hint about units. Prefer min_price + currency.",
          "type": "number"
        },
        "name": {
          "type": "string"
        },
        "requires_account": {
          "description": "true = you must send account_number when ordering (top-ups). Derived from the product's fields[], so it is safe to branch on.",
          "type": "boolean"
        },
        "requires_amount": {
          "description": "true = variable-amount product: send amount instead of item_id.",
          "type": "boolean"
        },
        "type": {
          "enum": [
            "voucher",
            "recharge_fixed",
            "recharge",
            "e_sim"
          ],
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}