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

package com.azure.resourcemanager.logic.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.resourcemanager.logic.models.IntegrationAccountSku;
import com.azure.resourcemanager.logic.models.ResourceReference;
import com.azure.resourcemanager.logic.models.WorkflowState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The integration account. */
@Fluent
public final class IntegrationAccountInner extends Resource {
    /*
     * The integration account properties.
     */
    @JsonProperty(value = "properties")
    private IntegrationAccountProperties innerProperties;

    /*
     * The sku.
     */
    @JsonProperty(value = "sku")
    private IntegrationAccountSku sku;

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

    /**
     * Get the innerProperties property: The integration account properties.
     *
     * @return the innerProperties value.
     */
    private IntegrationAccountProperties innerProperties() {
        return this.innerProperties;
    }

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

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

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

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

    /**
     * Get the integrationServiceEnvironment property: The integration service environment.
     *
     * @return the integrationServiceEnvironment value.
     */
    public ResourceReference integrationServiceEnvironment() {
        return this.innerProperties() == null ? null : this.innerProperties().integrationServiceEnvironment();
    }

    /**
     * Set the integrationServiceEnvironment property: The integration service environment.
     *
     * @param integrationServiceEnvironment the integrationServiceEnvironment value to set.
     * @return the IntegrationAccountInner object itself.
     */
    public IntegrationAccountInner withIntegrationServiceEnvironment(ResourceReference integrationServiceEnvironment) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IntegrationAccountProperties();
        }
        this.innerProperties().withIntegrationServiceEnvironment(integrationServiceEnvironment);
        return this;
    }

    /**
     * Get the state property: The workflow state.
     *
     * @return the state value.
     */
    public WorkflowState state() {
        return this.innerProperties() == null ? null : this.innerProperties().state();
    }

    /**
     * Set the state property: The workflow state.
     *
     * @param state the state value to set.
     * @return the IntegrationAccountInner object itself.
     */
    public IntegrationAccountInner withState(WorkflowState state) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IntegrationAccountProperties();
        }
        this.innerProperties().withState(state);
        return this;
    }

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