{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "shortId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 12,
      "pattern": "^[A-Za-z0-9_-]+$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 500
        },
        {
          "type": "null"
        }
      ]
    },
    "sharedFiles": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "pattern": "^(?!\\.{1,2}$)[^/\\\\\\x00]+$"
          },
          "content": {
            "type": "string",
            "maxLength": 2000000
          }
        },
        "required": [
          "filename",
          "content"
        ],
        "additionalProperties": false
      }
    },
    "templates": {
      "maxItems": 3,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "shortId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 12,
            "pattern": "^[A-Za-z0-9_-]+$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "frameworkType": {
            "type": "string",
            "enum": [
              "GDPR",
              "TCF",
              "US"
            ]
          },
          "files": {
            "default": [],
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "vars",
                    "styles",
                    "view",
                    "template"
                  ]
                },
                "filename": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "pattern": "^(?!\\.{1,2}$)[^/\\\\\\x00]+$"
                },
                "content": {
                  "type": "string",
                  "maxLength": 2000000
                }
              },
              "required": [
                "kind",
                "filename",
                "content"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "name",
          "frameworkType",
          "files"
        ],
        "additionalProperties": false
      }
    },
    "scope": {
      "type": "string",
      "enum": [
        "org",
        "project",
        "app"
      ]
    },
    "scopeId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 12,
      "pattern": "^[A-Za-z0-9_-]+$"
    }
  },
  "required": [
    "name",
    "sharedFiles",
    "templates"
  ],
  "additionalProperties": false
}
