{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pagehub-dev/json-schema/pagehub-dev-domain-state-schema.json",
  "title": "DomainState",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pagehub-dev-openapi.json#/components/schemas/DomainState",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "id": {
      "type": "string"
    },
    "domain": {
      "type": [
        "string",
        "null"
      ]
    },
    "domainRedirectMode": {
      "type": "string",
      "enum": [
        "none",
        "to-apex",
        "to-www"
      ]
    },
    "checked": {
      "type": "string"
    },
    "pair": {
      "type": [
        "object",
        "null"
      ],
      "description": "`{ apex, www }` for an apex or www domain, else `{ primary }`.",
      "additionalProperties": true
    },
    "variants": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DomainVariant"
      }
    },
    "allowance": {
      "$ref": "#/$defs/Allowance",
      "description": "The owner's custom-domain meter; null when no plan can be resolved."
    },
    "noop": {
      "type": "boolean"
    },
    "detachFailures": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "available": {
      "type": "boolean"
    },
    "reason": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "domain"
  ],
  "additionalProperties": true,
  "$defs": {
    "Allowance": {
      "type": "object",
      "description": "How much of the owner's plan cap is used.",
      "additionalProperties": true
    },
    "DomainVariant": {
      "type": "object",
      "description": "One hostname of the domain pair and its Vercel and DNS state.",
      "properties": {
        "name": {
          "type": "string"
        },
        "attachedToPagehub": {
          "type": "boolean"
        },
        "available": {
          "type": "boolean"
        },
        "redirect": {
          "type": [
            "string",
            "null"
          ]
        },
        "redirectStatusCode": {
          "type": [
            "integer",
            "null"
          ]
        },
        "error": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          }
        },
        "misconfigured": {
          "type": "boolean"
        },
        "live": {
          "type": "boolean"
        },
        "records": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "configError": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "attachedToPagehub",
        "available"
      ],
      "additionalProperties": true
    }
  }
}