{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/kingchddg901/Vacuum_Agent/material-pack.schema.json",
  "title": "Vacuum Agent drop-in floor material",
  "description": "GENERATED from custom_components/eufy_vacuum/user_materials.py by scripts/material_pack_contract.py --schema. Do not hand-edit. Passing this schema is NECESSARY, NOT SUFFICIENT: canvas size, PNG colour type and bit depth are read from the files and are not expressible here. Run `python scripts/material_pack_contract.py <dir>` for the whole contract.",
  "type": "object",
  "required": [
    "schema",
    "id",
    "layers"
  ],
  "additionalProperties": false,
  "properties": {
    "schema": {
      "const": 1,
      "description": "Exactly 1. Any other value rejects the pack."
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
      "not": {
        "enum": [
          "carpet-high",
          "carpet-low",
          "concrete",
          "granite-light",
          "marble",
          "tile",
          "wood",
          "carpet_high_pile",
          "carpet_low_pile",
          "granite",
          "hardwood",
          "laminate",
          "default"
        ]
      },
      "description": "The namespace. Mints every token name, is the registry key, and is what a room's stored floor_material references \u2014 the one irreversible commitment in the pack. Must not EQUAL, PREFIX, or BE PREFIXED BY (hyphen-separated) any reserved name: carpet-high, carpet-low, concrete, granite-light, marble, tile, wood, carpet_high_pile, carpet_low_pile, granite, hardwood, laminate, default"
    },
    "name": {
      "type": "string",
      "description": "Display name. Defaults to id. The only string a user sees."
    },
    "family": {
      "type": "string",
      "description": "Free-text grouping, e.g. stone / wood / glass. Never validated."
    },
    "tileable": {
      "type": "boolean",
      "description": "A CLAIM, and the only way out of the default. Absent (or anything that is not the literal true) means this material is ART: fitted once to each room, overhang clipped, never repeated -- which asks nothing of you, since you cannot know a map's resolution or a room's size and aspect. Setting it true asserts two things: the masks are seamless edge to edge, AND sample_m / scale describe a physical size worth tiling at. NEITHER HALF IS VERIFIED: an automated seam test was built and withdrawn, because no edge-difference statistic separates a feature that legitimately LANDS on the tile boundary from one DUPLICATED across it -- the shipped wood-seam mask is seamless by construction and scores identically to a mask that is not. Check it by tiling your masks 2x2 in an editor and looking."
    },
    "scale": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Feature scale. Clamped to 0.02..2 at render (bindings/map.js). <=0 is dropped to null."
    },
    "sample_m": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "PHYSICAL sample size: how many METRES of real floor one tile of this material's masks covers. THE PREFERRED WAY TO SIZE A PACK - 'scale' is a raster multiplier that only means anything against the one map it was tuned on, while this means the same on every map and the card derives the scale from that map's own resolution. The default for every layer that does not declare its own."
    },
    "opacity": {
      "type": "number",
      "minimum": 0.0,
      "maximum": 1.0
    },
    "layers": {
      "type": "array",
      "minItems": 1,
      "maxItems": 8,
      "items": {
        "type": "object",
        "required": [
          "suffix",
          "color",
          "opacity"
        ],
        "additionalProperties": false,
        "properties": {
          "suffix": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,23}$",
            "description": "Mints --evcc-floor-<id>-<suffix>. Unique within the pack."
          },
          "file": {
            "type": "string",
            "pattern": "^[\\w][\\w.-]*\\.png$",
            "description": "A PNG in this pack's own directory. Mutually exclusive with 'from'."
          },
          "from": {
            "type": "string",
            "pattern": "^[a-z_]+/[\\w][\\w.-]*\\.png$",
            "description": "Borrow a SHIPPED mask: '<dir>/<file>.png'. Mutually exclusive with 'file'."
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$",
            "description": "#rrggbb or #rrggbbaa"
          },
          "opacity": {
            "type": "number",
            "minimum": 0.0,
            "maximum": 1.0
          },
          "primary": {
            "type": "boolean",
            "description": "At most ONE layer in the pack may set this true."
          },
          "scale": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "OPTIONAL per-layer feature scale, overriding the material's for this layer only. MAP PATH ONLY - the room card cover-fits every layer and reads no scale at all. Absent means 'follow the material'. For a mask that is NOT the same physical sample as its siblings; two cut from the SAME area must share a scale or their features drift apart as they tile."
          },
          "sample_m": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "OPTIONAL per-layer PHYSICAL sample size: how many METRES of real floor one tile of THIS mask covers. Outranks this layer's 'scale' wherever the map knows its own resolution. Prefer it over 'scale' for a mask cut from a different patch than its siblings - two masks cut from the SAME area given the same sample_m register on every map, which a matched pair of raster scales only does by accident."
          }
        },
        "oneOf": [
          {
            "required": [
              "file"
            ],
            "not": {
              "required": [
                "from"
              ]
            }
          },
          {
            "required": [
              "from"
            ],
            "not": {
              "required": [
                "file"
              ]
            }
          }
        ]
      }
    },
    "presets": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tokens": {
            "type": "object"
          },
          "colors": {
            "type": "object"
          }
        },
        "description": "Every key in 'tokens' and 'colors' MUST start with --evcc-floor-<id>- . One stray key rejects the whole pack, not just the preset."
      }
    }
  }
}
