{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://spec-first.dev/contracts/quality-gates/branch-protection-policy.schema.json",
  "title": "Branch Protection Policy",
  "type": "object",
  "required": [
    "schemaVersion",
    "provider",
    "mode",
    "protected_branches",
    "non_goals"
  ],
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "enum": [1]
    },
    "provider": {
      "type": "string",
      "enum": ["github"]
    },
    "mode": {
      "type": "string",
      "enum": ["advisory"]
    },
    "protected_branches": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "pattern",
          "required_checks"
        ],
        "properties": {
          "pattern": {
            "type": "string"
          },
          "required_checks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "check_id",
                "workflow_name",
                "workflow_path",
                "job_name",
                "command",
                "reason",
                "covers_paths"
              ],
              "properties": {
                "check_id": { "type": "string" },
                "workflow_name": { "type": "string" },
                "workflow_path": { "type": "string" },
                "job_name": { "type": "string" },
                "command": { "type": "string" },
                "reason": { "type": "string" },
                "covers_paths": {
                  "type": "array",
                  "items": { "type": "string" }
                }
              }
            }
          }
        }
      }
    },
    "non_goals": {
      "type": "array",
      "items": { "type": "string" }
    }
  }
}
