// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.kubernetesconfiguration.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Scope of the extension. It can be either Cluster or Namespace; but not both. */
@Fluent
public final class Scope {
    /*
     * Specifies that the scope of the extension is Cluster
     */
    @JsonProperty(value = "cluster")
    private ScopeCluster cluster;

    /*
     * Specifies that the scope of the extension is Namespace
     */
    @JsonProperty(value = "namespace")
    private ScopeNamespace namespace;

    /** Creates an instance of Scope class. */
    public Scope() {
    }

    /**
     * Get the cluster property: Specifies that the scope of the extension is Cluster.
     *
     * @return the cluster value.
     */
    public ScopeCluster cluster() {
        return this.cluster;
    }

    /**
     * Set the cluster property: Specifies that the scope of the extension is Cluster.
     *
     * @param cluster the cluster value to set.
     * @return the Scope object itself.
     */
    public Scope withCluster(ScopeCluster cluster) {
        this.cluster = cluster;
        return this;
    }

    /**
     * Get the namespace property: Specifies that the scope of the extension is Namespace.
     *
     * @return the namespace value.
     */
    public ScopeNamespace namespace() {
        return this.namespace;
    }

    /**
     * Set the namespace property: Specifies that the scope of the extension is Namespace.
     *
     * @param namespace the namespace value to set.
     * @return the Scope object itself.
     */
    public Scope withNamespace(ScopeNamespace namespace) {
        this.namespace = namespace;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (cluster() != null) {
            cluster().validate();
        }
        if (namespace() != null) {
            namespace().validate();
        }
    }
}
