{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aifinpay-io/json-schema/aifinpay-io-merchant-site-batch-preview-schema.json",
  "title": "MerchantSiteBatchPreview",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aifinpay-io-openapi.json#/components/schemas/MerchantSiteBatchPreview",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "preview_id",
    "digest",
    "expires_at",
    "base_revision",
    "context_revision",
    "changes",
    "errors",
    "can_confirm",
    "id_map",
    "sites"
  ],
  "properties": {
    "preview_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "digest": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "base_revision": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "context_revision": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "changes": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "kind",
          "summary"
        ],
        "properties": {
          "action": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "gateway_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "summary": {
            "type": "string"
          }
        }
      }
    },
    "errors": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "code",
          "message"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "can_confirm": {
      "type": "boolean"
    },
    "id_map": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "merchant_id",
          "gateway_id",
          "resource_ids"
        ],
        "properties": {
          "merchant_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "gateway_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "resource_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        }
      }
    },
    "sites": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "client_row_id",
          "name",
          "site_url",
          "upstream_base_url",
          "gateway_slug",
          "enabled_intent",
          "network_mode",
          "settlement_chain",
          "settlement_version",
          "pay_to",
          "merchant_id",
          "gateway_id",
          "proof_state"
        ],
        "properties": {
          "client_row_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 80
          },
          "site_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 200
          },
          "upstream_base_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "gateway_slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{2,39}$"
          },
          "enabled_intent": {
            "type": "boolean"
          },
          "network_mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "settlement_chain": {
            "type": "string"
          },
          "settlement_version": {
            "type": "string",
            "enum": [
              "1.2",
              "1.4"
            ]
          },
          "pay_to": {
            "type": "object",
            "additionalProperties": false,
            "required": [],
            "properties": {
              "evm": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              },
              "polygon": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              },
              "solana": {
                "type": "string",
                "minLength": 32,
                "maxLength": 44
              }
            }
          },
          "resources": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "route_pattern",
                "type"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "route_pattern": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "page",
                    "api",
                    "dataset",
                    "mcp_tool",
                    "product"
                  ]
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 60
                },
                "description": {
                  "type": "string",
                  "maxLength": 500
                },
                "active": {
                  "type": "boolean"
                },
                "paywall_enabled": {
                  "type": "boolean"
                },
                "currency": {
                  "const": "USD",
                  "type": "string"
                },
                "billing_unit": {
                  "const": "request",
                  "type": "string"
                },
                "unit_weight": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100000
                },
                "price_usd": {
                  "type": "string",
                  "pattern": "^(?:0|[1-9][0-9]*)(?:\\.[0-9]{1,6})?$"
                },
                "tier": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "standard",
                    "complex",
                    "premium",
                    null
                  ]
                },
                "chains": {
                  "type": "array",
                  "uniqueItems": true,
                  "items": {
                    "type": "string"
                  }
                },
                "payment_assets": {
                  "type": "array",
                  "uniqueItems": true,
                  "items": {
                    "type": "string"
                  }
                },
                "daily_unit_limit": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1,
                  "maximum": 100000000
                },
                "fallback_gateway_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "minLength": 1,
                  "maxLength": 100
                }
              }
            }
          },
          "merchant_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "gateway_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "proof_state": {
            "type": "string",
            "const": "PENDING_DNS"
          }
        }
      }
    }
  }
}