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

package com.azure.resourcemanager.timeseriesinsights.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.timeseriesinsights.fluent.models.Gen1EnvironmentMutableProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.Duration;
import java.util.Map;

/** Parameters supplied to the Update Environment operation to update a Gen1 environment. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("Gen1")
@Fluent
public final class Gen1EnvironmentUpdateParameters extends EnvironmentUpdateParameters {
    /*
     * The sku of the environment.
     */
    @JsonProperty(value = "sku")
    private Sku sku;

    /*
     * Properties of the Gen1 environment.
     */
    @JsonProperty(value = "properties")
    private Gen1EnvironmentMutableProperties innerProperties;

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

    /**
     * Get the sku property: The sku of the environment.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The sku of the environment.
     *
     * @param sku the sku value to set.
     * @return the Gen1EnvironmentUpdateParameters object itself.
     */
    public Gen1EnvironmentUpdateParameters withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of the Gen1 environment.
     *
     * @return the innerProperties value.
     */
    private Gen1EnvironmentMutableProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Get the dataRetentionTime property: ISO8601 timespan specifying the minimum number of days the environment's
     * events will be available for query.
     *
     * @return the dataRetentionTime value.
     */
    public Duration dataRetentionTime() {
        return this.innerProperties() == null ? null : this.innerProperties().dataRetentionTime();
    }

    /**
     * Set the dataRetentionTime property: ISO8601 timespan specifying the minimum number of days the environment's
     * events will be available for query.
     *
     * @param dataRetentionTime the dataRetentionTime value to set.
     * @return the Gen1EnvironmentUpdateParameters object itself.
     */
    public Gen1EnvironmentUpdateParameters withDataRetentionTime(Duration dataRetentionTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new Gen1EnvironmentMutableProperties();
        }
        this.innerProperties().withDataRetentionTime(dataRetentionTime);
        return this;
    }

    /**
     * Get the storageLimitExceededBehavior property: The behavior the Time Series Insights service should take when the
     * environment's capacity has been exceeded. If "PauseIngress" is specified, new events will not be read from the
     * event source. If "PurgeOldData" is specified, new events will continue to be read and old events will be deleted
     * from the environment. The default behavior is PurgeOldData.
     *
     * @return the storageLimitExceededBehavior value.
     */
    public StorageLimitExceededBehavior storageLimitExceededBehavior() {
        return this.innerProperties() == null ? null : this.innerProperties().storageLimitExceededBehavior();
    }

    /**
     * Set the storageLimitExceededBehavior property: The behavior the Time Series Insights service should take when the
     * environment's capacity has been exceeded. If "PauseIngress" is specified, new events will not be read from the
     * event source. If "PurgeOldData" is specified, new events will continue to be read and old events will be deleted
     * from the environment. The default behavior is PurgeOldData.
     *
     * @param storageLimitExceededBehavior the storageLimitExceededBehavior value to set.
     * @return the Gen1EnvironmentUpdateParameters object itself.
     */
    public Gen1EnvironmentUpdateParameters withStorageLimitExceededBehavior(
        StorageLimitExceededBehavior storageLimitExceededBehavior) {
        if (this.innerProperties() == null) {
            this.innerProperties = new Gen1EnvironmentMutableProperties();
        }
        this.innerProperties().withStorageLimitExceededBehavior(storageLimitExceededBehavior);
        return this;
    }

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