// 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;
import java.util.List;

/** Statuses of objects deployed by the user-specified kustomizations from the git repository. */
@Fluent
public final class ObjectStatusDefinition {
    /*
     * Name of the applied object
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Namespace of the applied object
     */
    @JsonProperty(value = "namespace")
    private String namespace;

    /*
     * Kind of the applied object
     */
    @JsonProperty(value = "kind")
    private String kind;

    /*
     * Compliance state of the applied object showing whether the applied object has come into a ready state on the
     * cluster.
     */
    @JsonProperty(value = "complianceState")
    private FluxComplianceState complianceState;

    /*
     * Object reference to the Kustomization that applied this object
     */
    @JsonProperty(value = "appliedBy")
    private ObjectReferenceDefinition appliedBy;

    /*
     * List of Kubernetes object status conditions present on the cluster
     */
    @JsonProperty(value = "statusConditions")
    private List<ObjectStatusConditionDefinition> statusConditions;

    /*
     * Additional properties that are provided from objects of the HelmRelease kind
     */
    @JsonProperty(value = "helmReleaseProperties")
    private HelmReleasePropertiesDefinition helmReleaseProperties;

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

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

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

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

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

    /**
     * Get the kind property: Kind of the applied object.
     *
     * @return the kind value.
     */
    public String kind() {
        return this.kind;
    }

    /**
     * Set the kind property: Kind of the applied object.
     *
     * @param kind the kind value to set.
     * @return the ObjectStatusDefinition object itself.
     */
    public ObjectStatusDefinition withKind(String kind) {
        this.kind = kind;
        return this;
    }

    /**
     * Get the complianceState property: Compliance state of the applied object showing whether the applied object has
     * come into a ready state on the cluster.
     *
     * @return the complianceState value.
     */
    public FluxComplianceState complianceState() {
        return this.complianceState;
    }

    /**
     * Set the complianceState property: Compliance state of the applied object showing whether the applied object has
     * come into a ready state on the cluster.
     *
     * @param complianceState the complianceState value to set.
     * @return the ObjectStatusDefinition object itself.
     */
    public ObjectStatusDefinition withComplianceState(FluxComplianceState complianceState) {
        this.complianceState = complianceState;
        return this;
    }

    /**
     * Get the appliedBy property: Object reference to the Kustomization that applied this object.
     *
     * @return the appliedBy value.
     */
    public ObjectReferenceDefinition appliedBy() {
        return this.appliedBy;
    }

    /**
     * Set the appliedBy property: Object reference to the Kustomization that applied this object.
     *
     * @param appliedBy the appliedBy value to set.
     * @return the ObjectStatusDefinition object itself.
     */
    public ObjectStatusDefinition withAppliedBy(ObjectReferenceDefinition appliedBy) {
        this.appliedBy = appliedBy;
        return this;
    }

    /**
     * Get the statusConditions property: List of Kubernetes object status conditions present on the cluster.
     *
     * @return the statusConditions value.
     */
    public List<ObjectStatusConditionDefinition> statusConditions() {
        return this.statusConditions;
    }

    /**
     * Set the statusConditions property: List of Kubernetes object status conditions present on the cluster.
     *
     * @param statusConditions the statusConditions value to set.
     * @return the ObjectStatusDefinition object itself.
     */
    public ObjectStatusDefinition withStatusConditions(List<ObjectStatusConditionDefinition> statusConditions) {
        this.statusConditions = statusConditions;
        return this;
    }

    /**
     * Get the helmReleaseProperties property: Additional properties that are provided from objects of the HelmRelease
     * kind.
     *
     * @return the helmReleaseProperties value.
     */
    public HelmReleasePropertiesDefinition helmReleaseProperties() {
        return this.helmReleaseProperties;
    }

    /**
     * Set the helmReleaseProperties property: Additional properties that are provided from objects of the HelmRelease
     * kind.
     *
     * @param helmReleaseProperties the helmReleaseProperties value to set.
     * @return the ObjectStatusDefinition object itself.
     */
    public ObjectStatusDefinition withHelmReleaseProperties(HelmReleasePropertiesDefinition helmReleaseProperties) {
        this.helmReleaseProperties = helmReleaseProperties;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (appliedBy() != null) {
            appliedBy().validate();
        }
        if (statusConditions() != null) {
            statusConditions().forEach(e -> e.validate());
        }
        if (helmReleaseProperties() != null) {
            helmReleaseProperties().validate();
        }
    }
}
