{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://forgecascade.org/directory-listing.schema.json",
  "title": "Forge Cascade directory commerce listing",
  "description": "Machine-readable schema for Forge directory listings, buyer routing, and checkout discovery.",
  "type": "object",
  "required": [
    "$schema",
    "updated",
    "name",
    "legal_name",
    "url",
    "checkout_routes",
    "recommended_first_checkout",
    "recommended_quick_checkout",
    "offers"
  ],
  "properties": {
    "$schema": {
      "const": "https://forgecascade.org/directory-listing.schema.json"
    },
    "updated": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "legal_name": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "pricing": {
      "type": "string",
      "format": "uri"
    },
    "buy_json": {
      "type": "string",
      "format": "uri"
    },
    "checkout_routes": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "format": "uri",
        "pattern": "^https://forgecascade\\.org/buy/"
      }
    },
    "recommended_first_checkout": {
      "$ref": "#/$defs/offer"
    },
    "recommended_quick_checkout": {
      "$ref": "#/$defs/offer"
    },
    "fast_paid_starts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/offer"
      }
    },
    "offers": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/offer"
      }
    },
    "proof_links": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/proof_link"
      }
    },
    "discovery": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "format": "uri"
      }
    },
    "buyer_routing": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "proof_link": {
      "type": "object",
      "required": [
        "name",
        "url",
        "status"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "status": {
          "const": "live_listing"
        },
        "kind": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "offer": {
      "type": "object",
      "required": [
        "name",
        "price_usd",
        "route_url",
        "checkout_url"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "price_usd": {
          "type": "number",
          "minimum": 0
        },
        "cadence": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "route_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://forgecascade\\.org/buy/"
        },
        "checkout_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://buy\\.stripe\\.com/"
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
