{
  "lexicon": 1,
  "id": "actor.rpg.generator",
  "description": "Generator metadata and decomposed layers for a sprite built with the rpg.actor sprite generator.",
  "defs": {
    "main": {
      "type": "record",
      "description": "Stores the recolored layers and configuration used to rebuild a generated sprite.",
      "key": "literal:self",
      "record": {
        "type": "object",
        "required": ["bodyType", "skin", "eyes", "layers", "createdAt"],
        "properties": {
          "bodyType": { "type": "string", "maxLength": 20 },
          "faceMode": {
            "type": "string",
            "knownValues": ["standard", "faceless"],
            "description": "Whether face layers are selected intentionally. Omission is reserved for legacy records pending migration."
          },
          "skin": { "type": "ref", "ref": "#skin" },
          "eyes": { "type": "ref", "ref": "#eyes" },
          "layers": {
            "type": "array",
            "description": "Ordered recolored layers, back-to-front.",
            "maxLength": 32,
            "items": { "type": "ref", "ref": "#layer" }
          },
          "items": {
            "type": "array",
            "maxLength": 20,
            "items": { "type": "string", "maxLength": 50 }
          },
          "createdAt": { "type": "string", "format": "datetime" },
          "updatedAt": { "type": "string", "format": "datetime" }
        }
      }
    },
    "skin": {
      "type": "object",
      "description": "Skin color configuration.",
      "properties": {
        "tone": { "type": "integer", "minimum": 0, "maximum": 100 },
        "mode": { "type": "string", "maxLength": 10 },
        "hex": { "type": "string", "maxLength": 7 }
      }
    },
    "eyes": {
      "type": "object",
      "description": "Eye color configuration.",
      "properties": {
        "mode": { "type": "string", "maxLength": 10 },
        "tone": { "type": "integer", "minimum": 0, "maximum": 100 },
        "hex": { "type": "string", "maxLength": 7 }
      }
    },
    "layer": {
      "type": "object",
      "description": "A rendered generator layer and its recomposition metadata.",
      "required": ["id", "blob"],
      "properties": {
        "id": { "type": "string", "maxLength": 30 },
        "blob": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 1000000
        },
        "assetName": { "type": "string", "maxLength": 100 },
        "title": { "type": "string", "maxLength": 100 },
        "colors": { "type": "ref", "ref": "#colors" },
        "subtractMask": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 50000
        },
        "heightMap": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 50000,
          "description": "Optional depth override map matching blob dimensions. Near-opaque black pixels (alpha >= 239; RGB channels <= 16) place source art rearward, and near-opaque white pixels (alpha >= 239; RGB channels >= 239) place it in the foreground. Transparent, translucent, and intermediate-gray pixels leave ordinary placement unchanged."
        },
        "submaskRule": {
          "type": "string",
          "knownValues": ["respect-all", "ignore-all", "ignore-layers-above", "ignore-layers-below"],
          "maxLength": 24,
          "description": "Controls which external subtractive masks may affect this layer. Omission means respect-all."
        },
        "submaskExclusions": {
          "type": "ref",
          "ref": "#submaskExclusions",
          "description": "Target-side exceptions to submaskRule. The layers array contains exact canonical source layer IDs and the classes array contains exact source layerClass or fitClass values; matching source masks are skipped before submaskRule is evaluated. Omission or empty arrays means no source-specific exclusions."
        },
        "behindRows": {
          "type": "array",
          "description": "Rows rendered behind the body. Empty explicitly means all rows render in front.",
          "maxLength": 4,
          "items": { "type": "integer", "minimum": 0, "maximum": 3 }
        },
        "zSlotByDir": {
          "type": "unknown",
          "description": "Per-direction draw-order slots [down, left, right, up]. Entries are non-negative integers or null when the category default applies."
        },
        "zSlot": {
          "type": "integer",
          "minimum": 0,
          "maximum": 30,
          "description": "Legacy all-direction draw-order slot. zSlotByDir takes precedence."
        },
        "suppress": { "type": "ref", "ref": "#suppressionRules" },
        "layerClass": {
          "type": "string",
          "maxLength": 90,
          "description": "Class assigned to this layer, such as hind.cloak."
        },
        "suppressAs": { "type": "ref", "ref": "#fallback" },
        "suppressSpecific": {
          "type": "unknown",
          "description": "Map from suppressor layerClass to either a structured fallback matching #fallback or a rule with default and bodyTypeAlt fallbacks. The active body-specific value takes priority over the class default, then suppressAs."
        },
        "disabled": { "type": "boolean" }
      }
    },
    "colors": {
      "type": "object",
      "description": "Selected recolor channels.",
      "properties": {
        "main": { "type": "string", "maxLength": 7 },
        "sub1": { "type": "string", "maxLength": 7 },
        "sub2": { "type": "string", "maxLength": 7 },
        "sub3": { "type": "string", "maxLength": 7 }
      }
    },
    "submaskExclusions": {
      "type": "object",
      "description": "Target-side exceptions for subtractive masks. List exact canonical source layer IDs in layers, or exact source layerClass or fitClass values in classes; matching source masks must not erase the target layer. Omission or empty arrays means no source-specific exclusions.",
      "properties": {
        "layers": {
          "type": "array",
          "maxLength": 32,
          "description": "Exact canonical source layer IDs whose subtractive masks must be skipped.",
          "items": { "type": "string", "maxLength": 30 }
        },
        "classes": {
          "type": "array",
          "maxLength": 64,
          "description": "Exact source layerClass or fitClass values whose subtractive masks must be skipped.",
          "items": { "type": "string", "maxLength": 90 }
        }
      }
    },
    "suppressionRules": {
      "type": "object",
      "description": "Layer IDs and classes hidden while this layer is active.",
      "properties": {
        "layers": {
          "type": "array",
          "maxLength": 20,
          "items": { "type": "string", "maxLength": 30 }
        },
        "classes": {
          "type": "array",
          "maxLength": 20,
          "items": { "type": "string", "maxLength": 90 }
        }
      }
    },
    "fallback": {
      "type": "object",
      "description": "Rendered replacement used when a layer is class-suppressed.",
      "required": ["assetName", "blob"],
      "properties": {
        "assetName": { "type": "string", "maxLength": 100 },
        "title": { "type": "string", "maxLength": 100 },
        "blob": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 1000000
        },
        "subtractMask": {
          "type": "blob",
          "accept": ["image/png"],
          "maxSize": 50000
        },
          "heightMap": {
            "type": "blob",
            "accept": ["image/png"],
            "maxSize": 50000,
            "description": "Optional depth override map: near-opaque black pixels (alpha >= 239; RGB channels <= 16) render rearward, near-opaque white pixels (alpha >= 239; RGB channels >= 239) render in front, and transparent, translucent, or intermediate-gray pixels retain ordinary placement."
        },
        "colors": { "type": "ref", "ref": "#colors" },
        "behindRows": {
          "type": "array",
          "maxLength": 4,
          "items": { "type": "integer", "minimum": 0, "maximum": 3 }
        },
        "zSlotByDir": { "type": "unknown" },
        "zSlot": { "type": "integer", "minimum": 0, "maximum": 30 }
      }
    }
  }
}
