{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "/marketplace-schemas/workflow-template-contribution.schema.json",
  "title": "SecurityRecipes workflow template contribution packet",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "generated_at",
    "contribution_target",
    "docs_expectation",
    "template"
  ],
  "properties": {
    "schema_version": {
      "const": "securityrecipes.marketplace.workflow-template.v1"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "contribution_target": {
      "const": "data/marketplace/workflow_templates.json"
    },
    "docs_expectation": {
      "type": "string",
      "minLength": 1
    },
    "template": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "label",
        "status",
        "workflow_value",
        "description",
        "default_recipe_query",
        "default_context_pack",
        "default_report_profile_id",
        "default_output_channel_id",
        "default_input_channel_ids",
        "default_approval_gate",
        "default_cadence",
        "target_hint"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "status": {
          "const": "community"
        },
        "workflow_value": {
          "type": "string",
          "enum": [
            "dependency",
            "sast",
            "sensitive-data",
            "mcp-guardrail",
            "base-image",
            "recipe-runbook"
          ]
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 320
        },
        "default_recipe_query": {
          "type": "string",
          "minLength": 1
        },
        "default_context_pack": {
          "type": "string",
          "minLength": 1
        },
        "default_report_profile_id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "default_output_channel_id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "default_input_channel_ids": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          }
        },
        "default_approval_gate": {
          "type": "string",
          "minLength": 1
        },
        "default_cadence": {
          "type": "string",
          "minLength": 1
        },
        "target_hint": {
          "type": "string",
          "maxLength": 160
        },
        "governance": {
          "type": "object",
          "additionalProperties": false,
          "required": ["pack_version", "owner", "reviewed_at", "review_cadence_days"],
          "properties": {
            "pack_version": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
            },
            "owner": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "reviewed_at": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "review_cadence_days": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365
            },
            "docs_href": {
              "type": "string",
              "minLength": 1,
              "maxLength": 240
            },
            "required_pack_ids": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
              }
            },
            "optional_pack_ids": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
              }
            },
            "capability_tags": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9._-]*$"
              }
            }
          }
        }
      }
    }
  }
}
