// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource;
import com.azure.resourcemanager.newrelicobservability.models.LiftrResourceCategories;
import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity;
import com.azure.resourcemanager.newrelicobservability.models.MarketplaceSubscriptionStatus;
import com.azure.resourcemanager.newrelicobservability.models.MonitoringStatus;
import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties;
import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource;
import com.azure.resourcemanager.newrelicobservability.models.PlanData;
import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState;
import com.azure.resourcemanager.newrelicobservability.models.UserInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** A Monitor Resource by NewRelic. */
@Fluent
public final class NewRelicMonitorResourceInner extends Resource {
    /*
     * The resource-specific properties for this resource.
     */
    @JsonProperty(value = "properties", required = true)
    private MonitorProperties innerProperties = new MonitorProperties();

    /*
     * The managed service identities assigned to this resource.
     */
    @JsonProperty(value = "identity")
    private ManagedServiceIdentity identity;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the innerProperties property: The resource-specific properties for this resource.
     *
     * @return the innerProperties value.
     */
    private MonitorProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * 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 NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public NewRelicMonitorResourceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public NewRelicMonitorResourceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning State of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

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

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

    /**
     * Get the marketplaceSubscriptionId property: Marketplace Subscription Id.
     *
     * @return the marketplaceSubscriptionId value.
     */
    public String marketplaceSubscriptionId() {
        return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionId();
    }

    /**
     * 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 NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withNewRelicAccountProperties(
        NewRelicAccountProperties newRelicAccountProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        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 NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withUserInfo(UserInfo userInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        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 NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withPlanData(PlanData planData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withPlanData(planData);
        return this;
    }

    /**
     * Get the liftrResourceCategory property: Liftr resource category.
     *
     * @return the liftrResourceCategory value.
     */
    public LiftrResourceCategories liftrResourceCategory() {
        return this.innerProperties() == null ? null : this.innerProperties().liftrResourceCategory();
    }

    /**
     * Get the liftrResourcePreference property: Liftr resource preference. The priority of the resource.
     *
     * @return the liftrResourcePreference value.
     */
    public Integer liftrResourcePreference() {
        return this.innerProperties() == null ? null : this.innerProperties().liftrResourcePreference();
    }

    /**
     * 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 NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withOrgCreationSource(OrgCreationSource orgCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        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 NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withAccountCreationSource(AccountCreationSource accountCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withAccountCreationSource(accountCreationSource);
        return this;
    }

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

    private static final ClientLogger LOGGER = new ClientLogger(NewRelicMonitorResourceInner.class);
}
