{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://confighub.github.io/helm-expt/schemas/operational-class-examples.schema.json",
  "title": "Config catalog operational class examples",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "apiVersion",
    "kind",
    "metadata",
    "spec"
  ],
  "properties": {
    "apiVersion": {
      "const": "catalog.confighub.com/v1alpha1"
    },
    "kind": {
      "const": "OperationalClassExamples"
    },
    "metadata": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "const": "catalog-operational-classes"
        }
      }
    },
    "spec": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "examples"
      ],
      "properties": {
        "examples": {
          "type": "array",
          "minItems": 3,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "why",
              "record",
              "liveSpace",
              "sourceType",
              "operations",
              "target",
              "gates",
              "rollout",
              "evidence"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9-]+$"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "why": {
                "type": "string",
                "minLength": 1
              },
              "record": {
                "type": "string",
                "minLength": 1
              },
              "liveSpace": {
                "type": "string",
                "minLength": 1
              },
              "sourceType": {
                "type": "string",
                "minLength": 1
              },
              "operations": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "resourceClass",
                  "ownerClass",
                  "changeCadence"
                ],
                "properties": {
                  "resourceClass": {
                    "enum": [
                      "user-workload",
                      "system-service",
                      "system-configuration"
                    ]
                  },
                  "ownerClass": {
                    "enum": [
                      "application-team",
                      "platform-service-team",
                      "platform-team"
                    ]
                  },
                  "changeCadence": {
                    "enum": [
                      "application-release",
                      "planned-service-release",
                      "planned-platform-release"
                    ]
                  }
                }
              },
              "target": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "scope",
                  "ownerClass",
                  "selection"
                ],
                "properties": {
                  "scope": {
                    "enum": [
                      "application-namespace",
                      "shared-service-namespace",
                      "cluster"
                    ]
                  },
                  "ownerClass": {
                    "type": "string",
                    "minLength": 1
                  },
                  "selection": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "gates": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "normalSet",
                  "productionSet"
                ],
                "properties": {
                  "normalSet": {
                    "enum": [
                      "baseline",
                      "approvalRequired"
                    ]
                  },
                  "productionSet": {
                    "const": "approvalRequired"
                  }
                }
              },
              "rollout": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "method",
                  "sequence",
                  "status",
                  "limit"
                ],
                "properties": {
                  "method": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sequence": {
                    "type": "array",
                    "minItems": 2,
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "status": {
                    "enum": [
                      "observed",
                      "fresh-install-observed",
                      "single-cluster-observed"
                    ]
                  },
                  "limit": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "evidence": {
                "type": "array",
                "minItems": 2,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          }
        }
      }
    }
  }
}
