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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.automation.models.AutomationAccountState;
import com.azure.resourcemanager.automation.models.EncryptionProperties;
import com.azure.resourcemanager.automation.models.Identity;
import com.azure.resourcemanager.automation.models.Sku;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** Definition of the automation account type. */
@Fluent
public final class AutomationAccountInner extends Resource {
    /*
     * Gets or sets the automation account properties.
     */
    @JsonProperty(value = "properties")
    private AutomationAccountProperties innerProperties;

    /*
     * Gets or sets the etag of the resource.
     */
    @JsonProperty(value = "etag")
    private String etag;

    /*
     * Identity for the resource.
     */
    @JsonProperty(value = "identity")
    private Identity identity;

    /*
     * Resource system metadata.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /**
     * Get the innerProperties property: Gets or sets the automation account properties.
     *
     * @return the innerProperties value.
     */
    private AutomationAccountProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the etag property: Gets or sets the etag of the resource.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: Gets or sets the etag of the resource.
     *
     * @param etag the etag value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the identity property: Identity for the resource.
     *
     * @return the identity value.
     */
    public Identity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Identity for the resource.
     *
     * @param identity the identity value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the systemData property: Resource system metadata.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

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

    /**
     * Get the sku property: Gets or sets the SKU of account.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.innerProperties() == null ? null : this.innerProperties().sku();
    }

    /**
     * Set the sku property: Gets or sets the SKU of account.
     *
     * @param sku the sku value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withSku(Sku sku) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withSku(sku);
        return this;
    }

    /**
     * Get the lastModifiedBy property: Gets or sets the last modified by.
     *
     * @return the lastModifiedBy value.
     */
    public String lastModifiedBy() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy();
    }

    /**
     * Set the lastModifiedBy property: Gets or sets the last modified by.
     *
     * @param lastModifiedBy the lastModifiedBy value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withLastModifiedBy(String lastModifiedBy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withLastModifiedBy(lastModifiedBy);
        return this;
    }

    /**
     * Get the state property: Gets status of account.
     *
     * @return the state value.
     */
    public AutomationAccountState state() {
        return this.innerProperties() == null ? null : this.innerProperties().state();
    }

    /**
     * Get the creationTime property: Gets the creation time.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().creationTime();
    }

    /**
     * Get the lastModifiedTime property: Gets the last modified time.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
    }

    /**
     * Get the description property: Gets or sets the description.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Gets or sets the description.
     *
     * @param description the description value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the encryption property: Encryption properties for the automation account.
     *
     * @return the encryption value.
     */
    public EncryptionProperties encryption() {
        return this.innerProperties() == null ? null : this.innerProperties().encryption();
    }

    /**
     * Set the encryption property: Encryption properties for the automation account.
     *
     * @param encryption the encryption value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withEncryption(EncryptionProperties encryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withEncryption(encryption);
        return this;
    }

    /**
     * Get the privateEndpointConnections property: List of Automation operations supported by the Automation resource
     * provider.
     *
     * @return the privateEndpointConnections value.
     */
    public List<PrivateEndpointConnectionInner> privateEndpointConnections() {
        return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections();
    }

    /**
     * Set the privateEndpointConnections property: List of Automation operations supported by the Automation resource
     * provider.
     *
     * @param privateEndpointConnections the privateEndpointConnections value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withPrivateEndpointConnections(
        List<PrivateEndpointConnectionInner> privateEndpointConnections) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withPrivateEndpointConnections(privateEndpointConnections);
        return this;
    }

    /**
     * Get the publicNetworkAccess property: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is
     * allowed from the public internet.
     *
     * @return the publicNetworkAccess value.
     */
    public Boolean publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is
     * allowed from the public internet.
     *
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withPublicNetworkAccess(Boolean publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

    /**
     * Get the disableLocalAuth property: Indicates whether requests using non-AAD authentication are blocked.
     *
     * @return the disableLocalAuth value.
     */
    public Boolean disableLocalAuth() {
        return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth();
    }

    /**
     * Set the disableLocalAuth property: Indicates whether requests using non-AAD authentication are blocked.
     *
     * @param disableLocalAuth the disableLocalAuth value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withDisableLocalAuth(Boolean disableLocalAuth) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withDisableLocalAuth(disableLocalAuth);
        return this;
    }

    /**
     * Get the automationHybridServiceUrl property: URL of automation hybrid service which is used for hybrid worker
     * on-boarding.
     *
     * @return the automationHybridServiceUrl value.
     */
    public String automationHybridServiceUrl() {
        return this.innerProperties() == null ? null : this.innerProperties().automationHybridServiceUrl();
    }

    /**
     * Set the automationHybridServiceUrl property: URL of automation hybrid service which is used for hybrid worker
     * on-boarding.
     *
     * @param automationHybridServiceUrl the automationHybridServiceUrl value to set.
     * @return the AutomationAccountInner object itself.
     */
    public AutomationAccountInner withAutomationHybridServiceUrl(String automationHybridServiceUrl) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutomationAccountProperties();
        }
        this.innerProperties().withAutomationHybridServiceUrl(automationHybridServiceUrl);
        return this;
    }

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