{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "const": "github"
    },
    "key": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024
    },
    "harness": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
    },
    "sandbox": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
    },
    "agentId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "guards": {
      "default": [],
      "maxItems": 10,
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "max_occurrences"
              },
              "enabled": {
                "default": true,
                "type": "boolean"
              },
              "limit": {
                "default": 3,
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "scope": {
                "default": "subject",
                "type": "string",
                "enum": [
                  "repository",
                  "subject",
                  "commit",
                  "event"
                ]
              },
              "windowSeconds": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 31536000
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "cooldown"
              },
              "enabled": {
                "default": true,
                "type": "boolean"
              },
              "scope": {
                "type": "string",
                "enum": [
                  "repository",
                  "subject",
                  "commit",
                  "event"
                ]
              },
              "seconds": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 31536000
              }
            },
            "required": [
              "type",
              "scope",
              "seconds"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "max_concurrent"
              },
              "enabled": {
                "default": true,
                "type": "boolean"
              },
              "scope": {
                "type": "string",
                "enum": [
                  "repository",
                  "subject",
                  "commit",
                  "event"
                ]
              },
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 100
              }
            },
            "required": [
              "type",
              "scope",
              "limit"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "deduplicate"
              },
              "enabled": {
                "default": true,
                "type": "boolean"
              },
              "scope": {
                "type": "string",
                "enum": [
                  "delivery",
                  "subject",
                  "commit",
                  "event"
                ]
              },
              "windowSeconds": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 31536000
              }
            },
            "required": [
              "type",
              "scope"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "initialPrompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 65536
    },
    "enabled": {
      "default": true,
      "type": "boolean"
    },
    "labelOperator": {
      "default": "has_any",
      "type": "string",
      "enum": [
        "has_any",
        "has_all",
        "has_none",
        "is_empty"
      ]
    },
    "labelScope": {
      "default": "current",
      "type": "string",
      "enum": [
        "current",
        "changed"
      ]
    },
    "labels": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "commentKeywords": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "mentionedLogins": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "commands": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "actorLogins": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "authorAssociations": {
      "default": [],
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "OWNER",
          "MEMBER",
          "COLLABORATOR",
          "CONTRIBUTOR",
          "FIRST_TIME_CONTRIBUTOR",
          "FIRST_TIMER",
          "NONE",
          "MANNEQUIN"
        ]
      }
    },
    "checkNames": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "checkApps": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "releaseTags": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "releaseKinds": {
      "default": [],
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "stable",
          "prerelease",
          "draft"
        ]
      }
    },
    "matchAllComments": {
      "default": false,
      "type": "boolean"
    },
    "commentScopes": {
      "default": [
        "issue",
        "pull_request"
      ],
      "minItems": 1,
      "maxItems": 2,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "issue",
          "pull_request"
        ]
      }
    },
    "branches": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "sourceBranches": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "targetBranches": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "pathPrefixes": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "conclusions": {
      "default": [],
      "maxItems": 9,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "success",
          "failure",
          "neutral",
          "cancelled",
          "timed_out",
          "action_required",
          "stale",
          "skipped",
          "startup_failure"
        ]
      }
    },
    "reviewStates": {
      "default": [],
      "maxItems": 4,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "approved",
          "changes_requested",
          "commented",
          "dismissed"
        ]
      }
    },
    "merged": {
      "type": "boolean"
    },
    "workflows": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^\\.github\\/workflows\\/[^/]+\\.ya?ml$"
      }
    },
    "pushBranchesOnly": {
      "default": false,
      "type": "boolean"
    },
    "ignoreBots": {
      "default": false,
      "type": "boolean"
    },
    "ignoreDrafts": {
      "default": false,
      "type": "boolean"
    },
    "eventType": {
      "type": "string",
      "const": "pull_request"
    },
    "actions": {
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "opened",
          "edited",
          "closed",
          "reopened",
          "synchronize",
          "labeled",
          "unlabeled",
          "ready_for_review"
        ]
      }
    }
  },
  "required": [
    "provider",
    "key",
    "name",
    "harness",
    "sandbox",
    "agentId",
    "initialPrompt",
    "eventType",
    "actions"
  ],
  "additionalProperties": false
}
