{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Lumina Selection Project",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "version",
    "name",
    "width",
    "height",
    "image",
    "mask",
    "effect"
  ],
  "properties": {
    "format": {
      "const": "lumina-selection"
    },
    "version": {
      "const": 1
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "width": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1024
    },
    "height": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1024
    },
    "image": {
      "type": "string",
      "pattern": "^data:image/png;base64,[A-Za-z0-9+/]+={0,2}$",
      "maxLength": 6000000,
      "description": "PNG IHDR dimensions must equal width and height."
    },
    "mask": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]+$",
      "maxLength": 262144,
      "description": "Four binary selection pixels per HEX nibble, most significant bit first, in row-major order. Exactly ceil(width*height/4) characters; unused final bits zero."
    },
    "effect": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "action",
        "feather",
        "amount",
        "color",
        "exposure",
        "saturation"
      ],
      "properties": {
        "action": {
          "enum": [
            "fill",
            "cutout",
            "erase",
            "adjust"
          ]
        },
        "feather": {
          "type": "integer",
          "minimum": 0,
          "maximum": 24
        },
        "amount": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "color": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "exposure": {
          "type": "number",
          "minimum": -3,
          "maximum": 3
        },
        "saturation": {
          "type": "number",
          "minimum": 0,
          "maximum": 200
        }
      }
    }
  }
}
