{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/dsh-bio-workflows@0.4.0/schema/wdl-bundle.schema.json",
  "title": "dsh-bio-workflows WDL bundle descriptor v1",
  "description": "A versioned, non-executable WDL asset bundle. Validation does not authorize workflow execution.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "bundleVersion",
    "manifest",
    "wdl",
    "source",
    "authors",
    "license",
    "verification",
    "files"
  ],
  "properties": {
    "bundleVersion": {
      "const": "1"
    },
    "manifest": {
      "$ref": "./workflow-manifest.schema.json"
    },
    "wdl": {
      "$ref": "#/$defs/wdl"
    },
    "source": {
      "$ref": "#/$defs/source"
    },
    "authors": {
      "type": "array",
      "maxItems": 32,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
      }
    },
    "license": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "verification": {
      "$ref": "#/$defs/verification"
    },
    "files": {
      "type": "array",
      "minItems": 1,
      "maxItems": 128,
      "items": {
        "$ref": "#/$defs/file"
      }
    }
  },
  "$defs": {
    "wdl": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "version",
        "entrypoint",
        "engines"
      ],
      "properties": {
        "version": {
          "enum": [
            "1.0",
            "1.1",
            "1.2",
            "1.3"
          ]
        },
        "entrypoint": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240,
          "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\).+\\.wdl$"
        },
        "engines": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/engine"
          }
        }
      }
    },
    "engine": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$"
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "description": "Exact engine version used for the recorded compatibility check."
        }
      }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "enum": [
            "builtin",
            "local",
            "git",
            "trs"
          ]
        },
        "repository": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "revision": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "checks"
      ],
      "properties": {
        "status": {
          "enum": [
            "unverified",
            "structural",
            "verified"
          ]
        },
        "checks": {
          "type": "array",
          "maxItems": 32,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        }
      }
    },
    "file": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "role",
        "sha256"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240,
          "pattern": "^(?!workflow\\.json$)(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\\\).+$"
        },
        "role": {
          "enum": [
            "workflow",
            "task",
            "example",
            "documentation",
            "license"
          ]
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    }
  }
}
