{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tier1-shop/json-schema/tier1-shop-replacement-offer-schema.json",
  "title": "ReplacementOffer",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tier1-shop-openapi.json#/components/schemas/ReplacementOffer",
  "type": "object",
  "required": [
    "link_id",
    "geo",
    "eligible",
    "current_url",
    "current_anchor",
    "pending_replacement",
    "credits_required",
    "credits_available",
    "purchase_offers",
    "next_action"
  ],
  "properties": {
    "link_id": {
      "type": "integer",
      "minimum": 0
    },
    "geo": {
      "type": "string",
      "enum": [
        "ru",
        "intl"
      ]
    },
    "status": {
      "type": "string"
    },
    "eligible": {
      "type": "boolean"
    },
    "pending_replacement": {
      "type": "boolean"
    },
    "current_url": {
      "type": "string"
    },
    "current_anchor": {
      "type": "string"
    },
    "credits_required": {
      "type": "integer",
      "minimum": 0
    },
    "credits_available": {
      "type": "integer",
      "minimum": 0
    },
    "wallet_will_be_charged": {
      "type": "boolean",
      "const": false
    },
    "purchase_offers": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "product_id",
          "kind",
          "service_slots",
          "price"
        ],
        "properties": {
          "product_id": {
            "type": "integer",
            "minimum": 0
          },
          "kind": {
            "type": "string",
            "const": "replacement"
          },
          "name": {
            "type": "string"
          },
          "geo": {
            "type": "string"
          },
          "service_slots": {
            "type": "object",
            "properties": {
              "replacement": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "price": {
            "$ref": "#/$defs/Money"
          }
        }
      }
    },
    "next_action": {
      "type": "string",
      "enum": [
        "not_eligible_use_draft_edit_if_available",
        "track_existing_replacement",
        "confirm_and_submit_replacement",
        "confirm_and_save_replacement",
        "buy_replacement_credits_via_checkout"
      ]
    }
  },
  "$defs": {
    "Money": {
      "type": "object",
      "required": [
        "currency",
        "amount_minor",
        "minor_unit"
      ],
      "properties": {
        "currency": {
          "type": "string",
          "enum": [
            "RUB",
            "USD"
          ]
        },
        "amount_minor": {
          "type": "integer"
        },
        "minor_unit": {
          "type": "integer",
          "const": 2
        }
      }
    }
  }
}