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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.resourcemanager.synapse.models.CspWorkspaceAdminProperties;
import com.azure.resourcemanager.synapse.models.DataLakeStorageAccountDetails;
import com.azure.resourcemanager.synapse.models.EncryptionDetails;
import com.azure.resourcemanager.synapse.models.ManagedIdentity;
import com.azure.resourcemanager.synapse.models.ManagedVirtualNetworkSettings;
import com.azure.resourcemanager.synapse.models.PurviewConfiguration;
import com.azure.resourcemanager.synapse.models.VirtualNetworkProfile;
import com.azure.resourcemanager.synapse.models.WorkspacePublicNetworkAccess;
import com.azure.resourcemanager.synapse.models.WorkspaceRepositoryConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/** A workspace. */
@Fluent
public final class WorkspaceInner extends Resource {
    /*
     * Workspace resource properties
     */
    @JsonProperty(value = "properties")
    private WorkspaceProperties innerProperties;

    /*
     * Identity of the workspace
     */
    @JsonProperty(value = "identity")
    private ManagedIdentity identity;

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

    /**
     * Get the innerProperties property: Workspace resource properties.
     *
     * @return the innerProperties value.
     */
    private WorkspaceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the identity property: Identity of the workspace.
     *
     * @return the identity value.
     */
    public ManagedIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Identity of the workspace.
     *
     * @param identity the identity value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withIdentity(ManagedIdentity identity) {
        this.identity = identity;
        return this;
    }

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

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

    /**
     * Get the defaultDataLakeStorage property: Workspace default data lake storage account details.
     *
     * @return the defaultDataLakeStorage value.
     */
    public DataLakeStorageAccountDetails defaultDataLakeStorage() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultDataLakeStorage();
    }

    /**
     * Set the defaultDataLakeStorage property: Workspace default data lake storage account details.
     *
     * @param defaultDataLakeStorage the defaultDataLakeStorage value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withDefaultDataLakeStorage(DataLakeStorageAccountDetails defaultDataLakeStorage) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withDefaultDataLakeStorage(defaultDataLakeStorage);
        return this;
    }

    /**
     * Get the sqlAdministratorLoginPassword property: SQL administrator login password.
     *
     * @return the sqlAdministratorLoginPassword value.
     */
    public String sqlAdministratorLoginPassword() {
        return this.innerProperties() == null ? null : this.innerProperties().sqlAdministratorLoginPassword();
    }

    /**
     * Set the sqlAdministratorLoginPassword property: SQL administrator login password.
     *
     * @param sqlAdministratorLoginPassword the sqlAdministratorLoginPassword value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withSqlAdministratorLoginPassword(String sqlAdministratorLoginPassword) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withSqlAdministratorLoginPassword(sqlAdministratorLoginPassword);
        return this;
    }

    /**
     * Get the managedResourceGroupName property: Workspace managed resource group. The resource group name uniquely
     * identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90
     * characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note
     * that the name cannot end with '.'.
     *
     * @return the managedResourceGroupName value.
     */
    public String managedResourceGroupName() {
        return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupName();
    }

    /**
     * Set the managedResourceGroupName property: Workspace managed resource group. The resource group name uniquely
     * identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90
     * characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note
     * that the name cannot end with '.'.
     *
     * @param managedResourceGroupName the managedResourceGroupName value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withManagedResourceGroupName(String managedResourceGroupName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withManagedResourceGroupName(managedResourceGroupName);
        return this;
    }

    /**
     * Get the provisioningState property: Resource provisioning state.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the sqlAdministratorLogin property: Login for workspace SQL active directory administrator.
     *
     * @return the sqlAdministratorLogin value.
     */
    public String sqlAdministratorLogin() {
        return this.innerProperties() == null ? null : this.innerProperties().sqlAdministratorLogin();
    }

    /**
     * Set the sqlAdministratorLogin property: Login for workspace SQL active directory administrator.
     *
     * @param sqlAdministratorLogin the sqlAdministratorLogin value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withSqlAdministratorLogin(String sqlAdministratorLogin) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withSqlAdministratorLogin(sqlAdministratorLogin);
        return this;
    }

    /**
     * Get the virtualNetworkProfile property: Virtual Network profile.
     *
     * @return the virtualNetworkProfile value.
     */
    public VirtualNetworkProfile virtualNetworkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkProfile();
    }

    /**
     * Set the virtualNetworkProfile property: Virtual Network profile.
     *
     * @param virtualNetworkProfile the virtualNetworkProfile value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withVirtualNetworkProfile(VirtualNetworkProfile virtualNetworkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withVirtualNetworkProfile(virtualNetworkProfile);
        return this;
    }

    /**
     * Get the connectivityEndpoints property: Connectivity endpoints.
     *
     * @return the connectivityEndpoints value.
     */
    public Map<String, String> connectivityEndpoints() {
        return this.innerProperties() == null ? null : this.innerProperties().connectivityEndpoints();
    }

    /**
     * Get the managedVirtualNetwork property: Setting this to 'default' will ensure that all compute for this workspace
     * is in a virtual network managed on behalf of the user.
     *
     * @return the managedVirtualNetwork value.
     */
    public String managedVirtualNetwork() {
        return this.innerProperties() == null ? null : this.innerProperties().managedVirtualNetwork();
    }

    /**
     * Set the managedVirtualNetwork property: Setting this to 'default' will ensure that all compute for this workspace
     * is in a virtual network managed on behalf of the user.
     *
     * @param managedVirtualNetwork the managedVirtualNetwork value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withManagedVirtualNetwork(String managedVirtualNetwork) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withManagedVirtualNetwork(managedVirtualNetwork);
        return this;
    }

    /**
     * Get the privateEndpointConnections property: Private endpoint connections to the workspace.
     *
     * @return the privateEndpointConnections value.
     */
    public List<PrivateEndpointConnectionInner> privateEndpointConnections() {
        return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections();
    }

    /**
     * Set the privateEndpointConnections property: Private endpoint connections to the workspace.
     *
     * @param privateEndpointConnections the privateEndpointConnections value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withPrivateEndpointConnections(
        List<PrivateEndpointConnectionInner> privateEndpointConnections) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withPrivateEndpointConnections(privateEndpointConnections);
        return this;
    }

    /**
     * Get the encryption property: The encryption details of the workspace.
     *
     * @return the encryption value.
     */
    public EncryptionDetails encryption() {
        return this.innerProperties() == null ? null : this.innerProperties().encryption();
    }

    /**
     * Set the encryption property: The encryption details of the workspace.
     *
     * @param encryption the encryption value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withEncryption(EncryptionDetails encryption) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withEncryption(encryption);
        return this;
    }

    /**
     * Get the workspaceUid property: The workspace unique identifier.
     *
     * @return the workspaceUid value.
     */
    public UUID workspaceUid() {
        return this.innerProperties() == null ? null : this.innerProperties().workspaceUid();
    }

    /**
     * Get the extraProperties property: Workspace level configs and feature flags.
     *
     * @return the extraProperties value.
     */
    public Object extraProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().extraProperties();
    }

    /**
     * Get the managedVirtualNetworkSettings property: Managed Virtual Network Settings.
     *
     * @return the managedVirtualNetworkSettings value.
     */
    public ManagedVirtualNetworkSettings managedVirtualNetworkSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().managedVirtualNetworkSettings();
    }

    /**
     * Set the managedVirtualNetworkSettings property: Managed Virtual Network Settings.
     *
     * @param managedVirtualNetworkSettings the managedVirtualNetworkSettings value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withManagedVirtualNetworkSettings(
        ManagedVirtualNetworkSettings managedVirtualNetworkSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withManagedVirtualNetworkSettings(managedVirtualNetworkSettings);
        return this;
    }

    /**
     * Get the workspaceRepositoryConfiguration property: Git integration settings.
     *
     * @return the workspaceRepositoryConfiguration value.
     */
    public WorkspaceRepositoryConfiguration workspaceRepositoryConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().workspaceRepositoryConfiguration();
    }

    /**
     * Set the workspaceRepositoryConfiguration property: Git integration settings.
     *
     * @param workspaceRepositoryConfiguration the workspaceRepositoryConfiguration value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withWorkspaceRepositoryConfiguration(
        WorkspaceRepositoryConfiguration workspaceRepositoryConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withWorkspaceRepositoryConfiguration(workspaceRepositoryConfiguration);
        return this;
    }

    /**
     * Get the purviewConfiguration property: Purview Configuration.
     *
     * @return the purviewConfiguration value.
     */
    public PurviewConfiguration purviewConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().purviewConfiguration();
    }

    /**
     * Set the purviewConfiguration property: Purview Configuration.
     *
     * @param purviewConfiguration the purviewConfiguration value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withPurviewConfiguration(PurviewConfiguration purviewConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withPurviewConfiguration(purviewConfiguration);
        return this;
    }

    /**
     * Get the adlaResourceId property: The ADLA resource ID.
     *
     * @return the adlaResourceId value.
     */
    public String adlaResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().adlaResourceId();
    }

    /**
     * Get the publicNetworkAccess property: Enable or Disable public network access to workspace.
     *
     * @return the publicNetworkAccess value.
     */
    public WorkspacePublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Enable or Disable public network access to workspace.
     *
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withPublicNetworkAccess(WorkspacePublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

    /**
     * Get the cspWorkspaceAdminProperties property: Initial workspace AAD admin properties for a CSP subscription.
     *
     * @return the cspWorkspaceAdminProperties value.
     */
    public CspWorkspaceAdminProperties cspWorkspaceAdminProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().cspWorkspaceAdminProperties();
    }

    /**
     * Set the cspWorkspaceAdminProperties property: Initial workspace AAD admin properties for a CSP subscription.
     *
     * @param cspWorkspaceAdminProperties the cspWorkspaceAdminProperties value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withCspWorkspaceAdminProperties(CspWorkspaceAdminProperties cspWorkspaceAdminProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withCspWorkspaceAdminProperties(cspWorkspaceAdminProperties);
        return this;
    }

    /**
     * Get the settings property: Workspace settings.
     *
     * @return the settings value.
     */
    public Map<String, Object> settings() {
        return this.innerProperties() == null ? null : this.innerProperties().settings();
    }

    /**
     * Get the azureADOnlyAuthentication property: Enable or Disable AzureADOnlyAuthentication on All Workspace
     * subresource.
     *
     * @return the azureADOnlyAuthentication value.
     */
    public Boolean azureADOnlyAuthentication() {
        return this.innerProperties() == null ? null : this.innerProperties().azureADOnlyAuthentication();
    }

    /**
     * Set the azureADOnlyAuthentication property: Enable or Disable AzureADOnlyAuthentication on All Workspace
     * subresource.
     *
     * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withAzureADOnlyAuthentication(azureADOnlyAuthentication);
        return this;
    }

    /**
     * Get the trustedServiceBypassEnabled property: Is trustedServiceBypassEnabled for the workspace.
     *
     * @return the trustedServiceBypassEnabled value.
     */
    public Boolean trustedServiceBypassEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().trustedServiceBypassEnabled();
    }

    /**
     * Set the trustedServiceBypassEnabled property: Is trustedServiceBypassEnabled for the workspace.
     *
     * @param trustedServiceBypassEnabled the trustedServiceBypassEnabled value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withTrustedServiceBypassEnabled(Boolean trustedServiceBypassEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withTrustedServiceBypassEnabled(trustedServiceBypassEnabled);
        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();
        }
    }
}
