{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/hft71/schemas/model-config.schema.json",
  "title": "HFT71 Model Config",
  "description": "Normalized model configuration returned by HFT71_Models_Repository::get_model_config() and hft71_get_model().",
  "type": "object",
  "required": [
    "code",
    "label",
    "description",
    "base_price",
    "double_sided_surcharge",
    "wc_category_id",
    "sizes",
    "colors",
    "skus"
  ],
  "properties": {
    "code": {
      "type": "string",
      "minLength": 1,
      "description": "Unique model code (e.g. BY004)."
    },
    "label": {
      "type": "string",
      "description": "Human-readable model label."
    },
    "description": {
      "type": "string",
      "description": "HTML marketing copy and size tables."
    },
    "base_price": {
      "type": "number",
      "minimum": 0
    },
    "double_sided_surcharge": {
      "type": "number",
      "minimum": 0
    },
    "wc_category_id": {
      "type": ["integer", "null"],
      "minimum": 1,
      "description": "WooCommerce product_cat term ID, or null."
    },
    "sizes": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "description": "Ordered size labels for this model."
    },
    "colors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "hex"],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "hex": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$"
          }
        },
        "additionalProperties": false
      },
      "description": "Colors marked available for this model."
    },
    "skus": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1
      },
      "additionalProperties": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "minLength": 1
        },
        "additionalProperties": {
          "type": "string",
          "minLength": 1
        }
      },
      "description": "Nested map: colorName -> size -> SKU string."
    }
  },
  "additionalProperties": false
}
