{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "version",
    "name",
    "source",
    "text",
    "preview",
    "crop",
    "threshold",
    "polarity",
    "rotation",
    "tracking",
    "italic",
    "bold",
    "fonts",
    "selected",
    "shortlist"
  ],
  "properties": {
    "format": {
      "const": "lumina-type"
    },
    "version": {
      "const": 1
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "source": {
      "type": "string",
      "maxLength": 6000000,
      "pattern": "^data:image/png;base64,[A-Za-z0-9+/]+={0,2}$"
    },
    "text": {
      "type": "string",
      "maxLength": 80,
      "pattern": "^[^\\r\\n\\t]*$"
    },
    "preview": {
      "type": "string",
      "maxLength": 120,
      "pattern": "^[^\\r\\n\\t]*$"
    },
    "crop": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "x",
        "y",
        "width",
        "height"
      ],
      "properties": {
        "x": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "y": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "width": {
          "type": "number",
          "minimum": 0.001,
          "maximum": 1
        },
        "height": {
          "type": "number",
          "minimum": 0.001,
          "maximum": 1
        }
      }
    },
    "threshold": {
      "type": "integer",
      "minimum": 0,
      "maximum": 255
    },
    "polarity": {
      "enum": [
        "dark",
        "light"
      ]
    },
    "rotation": {
      "type": "number",
      "minimum": -15,
      "maximum": 15
    },
    "tracking": {
      "type": "number",
      "minimum": -0.05,
      "maximum": 0.15
    },
    "italic": {
      "type": "boolean"
    },
    "bold": {
      "type": "boolean"
    },
    "fonts": {
      "type": "array",
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "filename",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,60}$"
          },
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "data": {
            "type": "string",
            "maxLength": 2666668,
            "pattern": "^[A-Za-z0-9+/]+={0,2}$"
          }
        }
      }
    },
    "selected": {
      "type": "string",
      "maxLength": 160
    },
    "shortlist": {
      "type": "array",
      "maxItems": 32,
      "items": {
        "type": "string",
        "maxLength": 160
      }
    }
  }
}
