{
  "type": "object",
  "description": "KongConsumerGroup is the Schema for the kongconsumergroups API.",
  "properties": {
    "apiVersion": {
      "type": "string",
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources"
    },
    "kind": {
      "type": "string",
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "type": "object",
      "description": "KongConsumerGroupSpec defines the desired state of KongConsumerGroup.",
      "properties": {
        "controlPlaneRef": {
          "type": "object",
          "description": "ControlPlaneRef is a reference to a ControlPlane this ConsumerGroup is associated with.",
          "properties": {
            "konnectID": {
              "type": "string",
              "description": "KonnectID is the schema for the KonnectID type.\nThis field is required when the Type is konnectID.",
              "pattern": "^[0-9a-f]{8}(?:\\-[0-9a-f]{4}){3}-[0-9a-f]{12}$"
            },
            "konnectNamespacedRef": {
              "type": "object",
              "description": "KonnectNamespacedRef is a reference to a Konnect Control Plane entity inside the cluster.\nIt contains the name of the Konnect Control Plane.\nThis field is required when the Type is konnectNamespacedRef.",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Name is the name of the Konnect Control Plane."
                },
                "namespace": {
                  "type": "string",
                  "description": "Namespace is the namespace where the Konnect Control Plane is in.\nCurrently only cluster scoped resources (KongVault) are allowed to set `konnectNamespacedRef.namespace`."
                }
              },
              "additionalProperties": false,
              "required": [
                "name"
              ]
            },
            "type": {
              "type": "string",
              "description": "Type indicates the type of the control plane being referenced. Allowed values:\n- konnectID\n- konnectNamespacedRef\n- kic\n\nThe default is kic, which implies that the Control Plane is KIC.",
              "enum": [
                "konnectID",
                "konnectNamespacedRef",
                "kic"
              ],
              "default": "kic"
            }
          },
          "additionalProperties": false,
          "x-kubernetes-validations": [
            {
              "message": "'konnectID' type is not supported",
              "rule": "self.type != 'konnectID'"
            },
            {
              "message": "when type is konnectNamespacedRef, konnectNamespacedRef must be set",
              "rule": "(has(self.type) && self.type == 'konnectNamespacedRef') ? has(self.konnectNamespacedRef) : true"
            },
            {
              "message": "when type is konnectNamespacedRef, konnectID must not be set",
              "rule": "(has(self.type) && self.type == 'konnectNamespacedRef') ? !has(self.konnectID) : true"
            },
            {
              "message": "when type is konnectID, konnectID must be set",
              "rule": "(has(self.type) && self.type == 'konnectID') ? has(self.konnectID) : true"
            },
            {
              "message": "when type is konnectID, konnectNamespacedRef must not be set",
              "rule": "(has(self.type) && self.type == 'konnectID') ? !has(self.konnectNamespacedRef) : true"
            },
            {
              "message": "when type is kic, konnectID must not be set",
              "rule": "(has(self.type) && self.type == 'kic') ? !has(self.konnectID) : true"
            },
            {
              "message": "when type is kic, konnectNamespacedRef must not be set",
              "rule": "(has(self.type) && self.type == 'kic') ? !has(self.konnectNamespacedRef) : true"
            },
            {
              "message": "when type is unset, konnectID must not be set",
              "rule": "!has(self.type) ? !has(self.konnectID) : true"
            },
            {
              "message": "when type is unset, konnectNamespacedRef must not be set",
              "rule": "!has(self.type) ? !has(self.konnectNamespacedRef) : true"
            }
          ]
        },
        "name": {
          "type": "string",
          "description": "Name is the name of the ConsumerGroup in Kong."
        },
        "tags": {
          "type": "array",
          "description": "Tags is an optional set of tags applied to the ConsumerGroup.",
          "items": {
            "type": "string"
          },
          "maxItems": 20,
          "x-kubernetes-validations": [
            {
              "message": "tags entries must not be longer than 128 characters",
              "rule": "self.all(tag, size(tag) >= 1 && size(tag) <= 128)"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "status": {
      "type": "object",
      "description": "Status represents the current status of the KongConsumerGroup resource.",
      "default": {
        "conditions": [
          {
            "lastTransitionTime": "1970-01-01T00:00:00Z",
            "message": "Waiting for controller",
            "reason": "Pending",
            "status": "Unknown",
            "type": "Programmed"
          }
        ]
      },
      "properties": {
        "conditions": {
          "type": "array",
          "description": "Conditions describe the current conditions of the KongConsumerGroup.\n\nKnown condition types are:\n\n* \"Programmed\"",
          "items": {
            "type": "object",
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "type": "string",
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time"
              },
              "message": {
                "type": "string",
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768
              },
              "observedGeneration": {
                "type": "integer",
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0
              },
              "reason": {
                "type": "string",
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "minLength": 1,
                "maxLength": 1024,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$"
              },
              "status": {
                "type": "string",
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ]
              },
              "type": {
                "type": "string",
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$"
              }
            },
            "additionalProperties": false,
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ]
          },
          "maxItems": 8,
          "x-kubernetes-list-type": "map",
          "x-kubernetes-list-map-keys": [
            "type"
          ]
        },
        "konnect": {
          "type": "object",
          "description": "Konnect contains the Konnect entity status.",
          "properties": {
            "controlPlaneID": {
              "type": "string",
              "description": "ControlPlaneID is the Konnect ID of the ControlPlane this Route is associated with."
            },
            "id": {
              "type": "string",
              "description": "ID is the unique identifier of the Konnect entity as assigned by Konnect API.\nIf it's unset (empty string), it means the Konnect entity hasn't been created yet."
            },
            "organizationID": {
              "type": "string",
              "description": "OrgID is ID of Konnect Org that this entity has been created in."
            },
            "serverURL": {
              "type": "string",
              "description": "ServerURL is the URL of the Konnect server in which the entity exists."
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  },
  "x-kubernetes-validations": [
    {
      "message": "controlPlaneRef is required once set",
      "rule": "(!has(oldSelf.spec) || !has(oldSelf.spec.controlPlaneRef)) || has(self.spec.controlPlaneRef)"
    },
    {
      "message": "spec.controlPlaneRef cannot specify namespace for namespaced resource",
      "rule": "(!has(self.spec) || !has(self.spec.controlPlaneRef) || !has(self.spec.controlPlaneRef.konnectNamespacedRef)) ? true : !has(self.spec.controlPlaneRef.konnectNamespacedRef.__namespace__)"
    },
    {
      "message": "spec.controlPlaneRef is immutable when an entity is already Programmed",
      "rule": "(!has(oldSelf.spec) || !has(oldSelf.spec.controlPlaneRef)) ? true : (!has(self.status) || !self.status.conditions.exists(c, c.type == 'Programmed' && c.status == 'True')) ? true : oldSelf.spec.controlPlaneRef == self.spec.controlPlaneRef"
    }
  ]
}