{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "/marketplace-schemas/input-channel-contribution.schema.json",
  "title": "SecurityRecipes input channel contribution packet",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "generated_at",
    "contribution_target",
    "docs_expectation",
    "channel"
  ],
  "properties": {
    "schema_version": {
      "const": "securityrecipes.marketplace.input-channel.v1"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "contribution_target": {
      "const": "data/marketplace/input_channels.json"
    },
    "docs_expectation": {
      "type": "string",
      "minLength": 1
    },
    "channel": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "label",
        "category",
        "status",
        "runtime_support",
        "description",
        "auth_modes",
        "config"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "status": {
          "const": "community"
        },
        "runtime_support": {
          "type": "string",
          "enum": ["live", "live_or_copy", "copy_only", "config_only", "planned", "contract"]
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 320
        },
        "auth_modes": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9_-]+$"
          }
        },
        "config": {
          "type": "object",
          "required": ["type"],
          "properties": {
            "type": {
              "type": "string",
              "pattern": "^[a-z0-9_:-]+$"
            }
          },
          "additionalProperties": true
        },
        "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._-]*$"
              }
            }
          }
        }
      }
    }
  }
}
