{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/dsh-bio-workflows@0.4.0/schema/workflow-manifest.schema.json",
  "title": "dsh-bio-workflows manifest v1",
  "description": "Read-only catalog metadata. A valid manifest does not authorize or define workflow execution.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "version",
    "name",
    "summary",
    "status",
    "engine"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1"
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$"
    },
    "version": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "summary": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000
    },
    "status": {
      "enum": [
        "draft",
        "ready",
        "deprecated"
      ]
    },
    "engine": {
      "$ref": "#/$defs/engine"
    },
    "inputs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/input"
      },
      "default": []
    },
    "outputs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/output"
      },
      "default": []
    },
    "tags": {
      "type": "array",
      "maxItems": 32,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[a-z0-9][a-z0-9._-]*$"
      },
      "default": []
    }
  },
  "$defs": {
    "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 expected by declarative preflight. Omit to accept any declared version."
        }
      }
    },
    "input": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "type",
        "required"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$"
        },
        "type": {
          "$ref": "#/$defs/valueType"
        },
        "required": {
          "type": "boolean"
        },
        "cardinality": {
          "$ref": "#/$defs/cardinality"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        }
      }
    },
    "output": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "type"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$"
        },
        "type": {
          "$ref": "#/$defs/valueType"
        },
        "cardinality": {
          "$ref": "#/$defs/cardinality"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        }
      }
    },
    "valueType": {
      "enum": [
        "file",
        "directory",
        "string",
        "integer",
        "number",
        "boolean"
      ]
    },
    "cardinality": {
      "enum": [
        "one",
        "many"
      ],
      "default": "one"
    }
  }
}
