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

package com.azure.resourcemanager.containerservice.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The ManagedClusterPodIdentity model. */
@Fluent
public class ManagedClusterPodIdentity {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedClusterPodIdentity.class);

    /*
     * Name of the pod identity.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Namespace of the pod identity.
     */
    @JsonProperty(value = "namespace", required = true)
    private String namespace;

    /*
     * Information of the user assigned identity.
     */
    @JsonProperty(value = "identity", required = true)
    private UserAssignedIdentity identity;

    /*
     * The current provisioning state of the pod identity.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ManagedClusterPodIdentityProvisioningState provisioningState;

    /*
     * The provisioningInfo property.
     */
    @JsonProperty(value = "provisioningInfo", access = JsonProperty.Access.WRITE_ONLY)
    private ManagedClusterPodIdentityProvisioningInfo provisioningInfo;

    /**
     * Get the name property: Name of the pod identity.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the pod identity.
     *
     * @param name the name value to set.
     * @return the ManagedClusterPodIdentity object itself.
     */
    public ManagedClusterPodIdentity withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the namespace property: Namespace of the pod identity.
     *
     * @return the namespace value.
     */
    public String namespace() {
        return this.namespace;
    }

    /**
     * Set the namespace property: Namespace of the pod identity.
     *
     * @param namespace the namespace value to set.
     * @return the ManagedClusterPodIdentity object itself.
     */
    public ManagedClusterPodIdentity withNamespace(String namespace) {
        this.namespace = namespace;
        return this;
    }

    /**
     * Get the identity property: Information of the user assigned identity.
     *
     * @return the identity value.
     */
    public UserAssignedIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Information of the user assigned identity.
     *
     * @param identity the identity value to set.
     * @return the ManagedClusterPodIdentity object itself.
     */
    public ManagedClusterPodIdentity withIdentity(UserAssignedIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the provisioningState property: The current provisioning state of the pod identity.
     *
     * @return the provisioningState value.
     */
    public ManagedClusterPodIdentityProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the provisioningInfo property: The provisioningInfo property.
     *
     * @return the provisioningInfo value.
     */
    public ManagedClusterPodIdentityProvisioningInfo provisioningInfo() {
        return this.provisioningInfo;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (name() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property name in model ManagedClusterPodIdentity"));
        }
        if (namespace() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property namespace in model ManagedClusterPodIdentity"));
        }
        if (identity() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property identity in model ManagedClusterPodIdentity"));
        } else {
            identity().validate();
        }
        if (provisioningInfo() != null) {
            provisioningInfo().validate();
        }
    }
}
