{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tier1-shop/json-schema/tier1-shop-replacement-action-schema.json",
  "title": "ReplacementAction",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tier1-shop-openapi.json#/components/schemas/ReplacementAction",
  "type": "object",
  "required": [
    "link",
    "saved",
    "submission",
    "credits_available",
    "wallet_was_charged"
  ],
  "properties": {
    "link": {
      "$ref": "#/$defs/Link"
    },
    "saved": {
      "type": "boolean"
    },
    "credits_available": {
      "type": "integer",
      "minimum": 0
    },
    "wallet_was_charged": {
      "type": "boolean",
      "const": false
    },
    "submission": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "submitted": {
          "type": "integer",
          "minimum": 0
        },
        "duplicates": {
          "type": "integer",
          "minimum": 0
        },
        "submitted_link_ids": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 0
          }
        },
        "errors": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "Link": {
      "type": "object",
      "required": [
        "id",
        "order_id",
        "status"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "order_id": {
          "type": "integer",
          "description": "cabinet_order_id"
        },
        "geo": {
          "type": "string"
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        },
        "link_type": {
          "type": "string"
        },
        "placement_years": {
          "type": [
            "integer",
            "null"
          ]
        },
        "anchor": {
          "type": [
            "string",
            "null"
          ]
        },
        "context_text": {
          "type": [
            "string",
            "null"
          ]
        },
        "donor_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "screenshot_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string"
        },
        "scheduled_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "deadline_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "placed_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "expires_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  }
}