{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "StillMade portable normalized metadata v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "dependencies",
    "sources",
    "files",
    "lineage"
  ],
  "properties": {
    "format": {
      "const": "stillmade-block/1"
    },
    "dependencies": {
      "type": "array",
      "maxItems": 0
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "maxItems": 16,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "repository",
              "commit",
              "license",
              "paths",
              "evidence",
              "changes"
            ],
            "properties": {
              "repository": {
                "type": "string",
                "pattern": "^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
              },
              "commit": {
                "type": "string",
                "pattern": "^[a-f0-9]{40}$"
              },
              "license": {
                "enum": [
                  "MIT",
                  "BSD-2-Clause",
                  "BSD-3-Clause",
                  "ISC",
                  "Apache-2.0"
                ]
              },
              "paths": {
                "type": "array",
                "minItems": 1,
                "maxItems": 128,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "evidence": {
                "type": "array",
                "minItems": 1,
                "maxItems": 128,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "changes": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "license",
              "paths",
              "evidence",
              "changes"
            ],
            "properties": {
              "kind": {
                "const": "original"
              },
              "license": {
                "enum": [
                  "MIT",
                  "BSD-2-Clause",
                  "BSD-3-Clause",
                  "ISC",
                  "Apache-2.0"
                ]
              },
              "paths": {
                "type": "array",
                "minItems": 1,
                "maxItems": 128,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "evidence": {
                "type": "array",
                "minItems": 1,
                "maxItems": 128,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "changes": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000
              }
            }
          }
        ]
      }
    },
    "files": {
      "type": "object",
      "maxProperties": 200,
      "additionalProperties": {
        "type": "string"
      }
    },
    "lineage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "parents",
        "changes"
      ],
      "properties": {
        "parents": {
          "type": "array",
          "maxItems": 16,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "version",
              "digest"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "version": {
                "type": "string",
                "minLength": 1
              },
              "digest": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            }
          }
        },
        "changes": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
