// 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.core.util.logging.ClientLogger;
import com.azure.resourcemanager.timeseriesinsights.fluent.models.Gen2EnvironmentCreationProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import java.util.Map;

/** Parameters supplied to the Create or Update Environment operation for a Gen2 environment. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("Gen2")
@Fluent
public final class Gen2EnvironmentCreateOrUpdateParameters extends EnvironmentCreateOrUpdateParameters {
    /*
     * Properties used to create a Gen2 environment.
     */
    @JsonProperty(value = "properties", required = true)
    private Gen2EnvironmentCreationProperties innerProperties = new Gen2EnvironmentCreationProperties();

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

    /**
     * Get the innerProperties property: Properties used to create a Gen2 environment.
     *
     * @return the innerProperties value.
     */
    private Gen2EnvironmentCreationProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public Gen2EnvironmentCreateOrUpdateParameters withSku(Sku sku) {
        super.withSku(sku);
        return this;
    }

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

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

    /**
     * Get the timeSeriesIdProperties property: The list of event properties which will be used to define the
     * environment's time series id.
     *
     * @return the timeSeriesIdProperties value.
     */
    public List<TimeSeriesIdProperty> timeSeriesIdProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().timeSeriesIdProperties();
    }

    /**
     * Set the timeSeriesIdProperties property: The list of event properties which will be used to define the
     * environment's time series id.
     *
     * @param timeSeriesIdProperties the timeSeriesIdProperties value to set.
     * @return the Gen2EnvironmentCreateOrUpdateParameters object itself.
     */
    public Gen2EnvironmentCreateOrUpdateParameters withTimeSeriesIdProperties(
        List<TimeSeriesIdProperty> timeSeriesIdProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new Gen2EnvironmentCreationProperties();
        }
        this.innerProperties().withTimeSeriesIdProperties(timeSeriesIdProperties);
        return this;
    }

    /**
     * Get the storageConfiguration property: The storage configuration provides the connection details that allows the
     * Time Series Insights service to connect to the customer storage account that is used to store the environment's
     * data.
     *
     * @return the storageConfiguration value.
     */
    public Gen2StorageConfigurationInput storageConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().storageConfiguration();
    }

    /**
     * Set the storageConfiguration property: The storage configuration provides the connection details that allows the
     * Time Series Insights service to connect to the customer storage account that is used to store the environment's
     * data.
     *
     * @param storageConfiguration the storageConfiguration value to set.
     * @return the Gen2EnvironmentCreateOrUpdateParameters object itself.
     */
    public Gen2EnvironmentCreateOrUpdateParameters withStorageConfiguration(
        Gen2StorageConfigurationInput storageConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new Gen2EnvironmentCreationProperties();
        }
        this.innerProperties().withStorageConfiguration(storageConfiguration);
        return this;
    }

    /**
     * Get the warmStoreConfiguration property: The warm store configuration provides the details to create a warm store
     * cache that will retain a copy of the environment's data available for faster query.
     *
     * @return the warmStoreConfiguration value.
     */
    public WarmStoreConfigurationProperties warmStoreConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().warmStoreConfiguration();
    }

    /**
     * Set the warmStoreConfiguration property: The warm store configuration provides the details to create a warm store
     * cache that will retain a copy of the environment's data available for faster query.
     *
     * @param warmStoreConfiguration the warmStoreConfiguration value to set.
     * @return the Gen2EnvironmentCreateOrUpdateParameters object itself.
     */
    public Gen2EnvironmentCreateOrUpdateParameters withWarmStoreConfiguration(
        WarmStoreConfigurationProperties warmStoreConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new Gen2EnvironmentCreationProperties();
        }
        this.innerProperties().withWarmStoreConfiguration(warmStoreConfiguration);
        return this;
    }

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

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