# 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 Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.jobs_operations import JobsOperations
from .operations.providers_operations import ProvidersOperations
from .operations.storage_operations import StorageOperations
from .operations.quotas_operations import QuotasOperations
from . import models


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

    :param credentials: Credentials needed for the client to connect to Azure.
    :type credentials: :mod:`A msrestazure Credentials
     object<msrestazure.azure_active_directory>`
    :param subscription_id: The Azure subscription ID. This is a
     GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
    :type subscription_id: str
    :param resource_group_name: Name of an Azure resource group.
    :type resource_group_name: str
    :param workspace_name: Name of the workspace.
    :type workspace_name: str
    :param str base_url: Service URL
    """

    def __init__(
            self, credentials, subscription_id, resource_group_name, workspace_name, base_url=None):

        if credentials is None:
            raise ValueError("Parameter 'credentials' must not be None.")
        if subscription_id is None:
            raise ValueError("Parameter 'subscription_id' must not be None.")
        if resource_group_name is None:
            raise ValueError("Parameter 'resource_group_name' must not be None.")
        if workspace_name is None:
            raise ValueError("Parameter 'workspace_name' must not be None.")
        if not base_url:
            base_url = 'https://quantum.azure.com'

        super(QuantumClientConfiguration, self).__init__(base_url)

        self.add_user_agent('quantumclient/{}'.format(VERSION))
        self.add_user_agent('Azure-SDK-For-Python')

        self.credentials = credentials
        self.subscription_id = subscription_id
        self.resource_group_name = resource_group_name
        self.workspace_name = workspace_name


class QuantumClient(SDKClient):
    """Azure Quantum REST API client

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

    :ivar jobs: Jobs operations
    :vartype jobs: azure.quantum.operations.JobsOperations
    :ivar providers: Providers operations
    :vartype providers: azure.quantum.operations.ProvidersOperations
    :ivar storage: Storage operations
    :vartype storage: azure.quantum.operations.StorageOperations
    :ivar quotas: Quotas operations
    :vartype quotas: azure.quantum.operations.QuotasOperations

    :param credentials: Credentials needed for the client to connect to Azure.
    :type credentials: :mod:`A msrestazure Credentials
     object<msrestazure.azure_active_directory>`
    :param subscription_id: The Azure subscription ID. This is a
     GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
    :type subscription_id: str
    :param resource_group_name: Name of an Azure resource group.
    :type resource_group_name: str
    :param workspace_name: Name of the workspace.
    :type workspace_name: str
    :param str base_url: Service URL
    """

    def __init__(
            self, credentials, subscription_id, resource_group_name, workspace_name, base_url=None):

        self.config = QuantumClientConfiguration(credentials, subscription_id, resource_group_name, workspace_name, base_url)
        super(QuantumClient, 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-04-preview'
        self._serialize = Serializer(client_models)
        self._deserialize = Deserializer(client_models)

        self.jobs = JobsOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.providers = ProvidersOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.storage = StorageOperations(
            self._client, self.config, self._serialize, self._deserialize)
        self.quotas = QuotasOperations(
            self._client, self.config, self._serialize, self._deserialize)
