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

package com.azure.resourcemanager.newrelicobservability.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceUpdateProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The type used for update operations of the NewRelicMonitorResource. */
@Fluent
public final class NewRelicMonitorResourceUpdate {
    /*
     * The managed service identities assigned to this resource.
     */
    @JsonProperty(value = "identity")
    private ManagedServiceIdentity identity;

    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * The updatable properties of the NewRelicMonitorResource.
     */
    @JsonProperty(value = "properties")
    private NewRelicMonitorResourceUpdateProperties innerProperties;

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

    /**
     * Get the identity property: The managed service identities assigned to this resource.
     *
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The managed service identities assigned to this resource.
     *
     * @param identity the identity value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the innerProperties property: The updatable properties of the NewRelicMonitorResource.
     *
     * @return the innerProperties value.
     */
    private NewRelicMonitorResourceUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource.
     *
     * @return the newRelicAccountProperties value.
     */
    public NewRelicAccountProperties newRelicAccountProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().newRelicAccountProperties();
    }

    /**
     * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource.
     *
     * @param newRelicAccountProperties the newRelicAccountProperties value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withNewRelicAccountProperties(
        NewRelicAccountProperties newRelicAccountProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withNewRelicAccountProperties(newRelicAccountProperties);
        return this;
    }

    /**
     * Get the userInfo property: User Info.
     *
     * @return the userInfo value.
     */
    public UserInfo userInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().userInfo();
    }

    /**
     * Set the userInfo property: User Info.
     *
     * @param userInfo the userInfo value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withUserInfo(UserInfo userInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withUserInfo(userInfo);
        return this;
    }

    /**
     * Get the planData property: Plan details.
     *
     * @return the planData value.
     */
    public PlanData planData() {
        return this.innerProperties() == null ? null : this.innerProperties().planData();
    }

    /**
     * Set the planData property: Plan details.
     *
     * @param planData the planData value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withPlanData(PlanData planData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withPlanData(planData);
        return this;
    }

    /**
     * Get the orgCreationSource property: Source of org creation.
     *
     * @return the orgCreationSource value.
     */
    public OrgCreationSource orgCreationSource() {
        return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource();
    }

    /**
     * Set the orgCreationSource property: Source of org creation.
     *
     * @param orgCreationSource the orgCreationSource value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withOrgCreationSource(OrgCreationSource orgCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withOrgCreationSource(orgCreationSource);
        return this;
    }

    /**
     * Get the accountCreationSource property: Source of account creation.
     *
     * @return the accountCreationSource value.
     */
    public AccountCreationSource accountCreationSource() {
        return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource();
    }

    /**
     * Set the accountCreationSource property: Source of account creation.
     *
     * @param accountCreationSource the accountCreationSource value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withAccountCreationSource(AccountCreationSource accountCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withAccountCreationSource(accountCreationSource);
        return this;
    }

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