# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from msrest.exceptions import HttpOperationError
from .operations.monitoring_operations import MonitoringOperations
from .operations.spark_batch_operations import SparkBatchOperations
from .operations.spark_session_operations import SparkSessionOperations
from .operations.workspace_acl_operations import WorkspaceAclOperations
from . import models


class SynapseClientConfiguration(Configuration):
    """Configuration for SynapseClient
    Note that all parameters used to create this instance are saved as instance
    attributes.

    :param synapse_dns_suffix: Gets the DNS suffix used as the base for all
     Synapse service requests.
    :type synapse_dns_suffix: str
    :param livy_api_version: Valid api-version for the request.
    :type livy_api_version: str
    :param credentials: Subscription credentials which uniquely identify
     client subscription.
    :type credentials: None
    """

    def __init__(
            self, synapse_dns_suffix, livy_api_version, credentials):

        if synapse_dns_suffix is None:
            raise ValueError("Parameter 'synapse_dns_suffix' must not be None.")
        if livy_api_version is None:
            raise ValueError("Parameter 'livy_api_version' must not be None.")
        if credentials is None:
            raise ValueError("Parameter 'credentials' must not be None.")
        base_url = 'https://{workspaceName}.{SynapseDnsSuffix}'

        super(SynapseClientConfiguration, self).__init__(base_url)

        self.add_user_agent('azure-synapse/{}'.format(VERSION))

        self.synapse_dns_suffix = synapse_dns_suffix
        self.livy_api_version = livy_api_version
        self.credentials = credentials


class SynapseClient(SDKClient):
    """SynapseClient

    :ivar config: Configuration for client.
    :vartype config: SynapseClientConfiguration

    :ivar monitoring: Monitoring operations
    :vartype monitoring: azure.synapse.operations.MonitoringOperations
    :ivar spark_batch: SparkBatch operations
    :vartype spark_batch: azure.synapse.operations.SparkBatchOperations
    :ivar spark_session: SparkSession operations
    :vartype spark_session: azure.synapse.operations.SparkSessionOperations
    :ivar workspace_acl: WorkspaceAcl operations
    :vartype workspace_acl: azure.synapse.operations.WorkspaceAclOperations

    :param synapse_dns_suffix: Gets the DNS suffix used as the base for all
     Synapse service requests.
    :type synapse_dns_suffix: str
    :param livy_api_version: Valid api-version for the request.
    :type livy_api_version: str
    :param credentials: Subscription credentials which uniquely identify
     client subscription.
    :type credentials: None
    """

    def __init__(
            self, synapse_dns_suffix, livy_api_version, credentials):

        self.config = SynapseClientConfiguration(synapse_dns_suffix, livy_api_version, credentials)
        super(SynapseClient, self).__init__(self.config.credentials, self.config)

        client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
        self.api_version = '2019-11-01-preview'
        self._serialize = Serializer(client_models)
        self._deserialize = Deserializer(client_models)

        self.monitoring = MonitoringOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.spark_batch = SparkBatchOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.spark_session = SparkSessionOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.workspace_acl = WorkspaceAclOperations(
            self._client, self.config, self._serialize, self._deserialize)
