# coding=utf-8
# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

import sys
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union

from .. import _serialization

if sys.version_info >= (3, 9):
    from collections.abc import MutableMapping
else:
    from typing import MutableMapping  # type: ignore  # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
    # pylint: disable=unused-import,ungrouped-imports
    from .. import models as _models
JSON = MutableMapping[str, Any]  # pylint: disable=unsubscriptable-object


class BlobDetails(_serialization.Model):
    """Blob details.

    All required parameters must be populated in order to send to Azure.

    :ivar container_name: The container name. Required.
    :vartype container_name: str
    :ivar blob_name: The blob name.
    :vartype blob_name: str
    """

    _validation = {
        "container_name": {"required": True},
    }

    _attribute_map = {
        "container_name": {"key": "containerName", "type": "str"},
        "blob_name": {"key": "blobName", "type": "str"},
    }

    def __init__(self, *, container_name: str, blob_name: Optional[str] = None, **kwargs: Any) -> None:
        """
        :keyword container_name: The container name. Required.
        :paramtype container_name: str
        :keyword blob_name: The blob name.
        :paramtype blob_name: str
        """
        super().__init__(**kwargs)
        self.container_name = container_name
        self.blob_name = blob_name


class CostEstimate(_serialization.Model):
    """The job cost billed by the provider. The final cost on your bill might be slightly different
    due to added taxes and currency conversion rates.

    :ivar currency_code: The currency code.
    :vartype currency_code: str
    :ivar events: List of usage events.
    :vartype events: list[~azure.quantum._client.models.UsageEvent]
    :ivar estimated_total: The estimated total.
    :vartype estimated_total: float
    """

    _attribute_map = {
        "currency_code": {"key": "currencyCode", "type": "str"},
        "events": {"key": "events", "type": "[UsageEvent]"},
        "estimated_total": {"key": "estimatedTotal", "type": "float"},
    }

    def __init__(
        self,
        *,
        currency_code: Optional[str] = None,
        events: Optional[List["_models.UsageEvent"]] = None,
        estimated_total: Optional[float] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword currency_code: The currency code.
        :paramtype currency_code: str
        :keyword events: List of usage events.
        :paramtype events: list[~azure.quantum._client.models.UsageEvent]
        :keyword estimated_total: The estimated total.
        :paramtype estimated_total: float
        """
        super().__init__(**kwargs)
        self.currency_code = currency_code
        self.events = events
        self.estimated_total = estimated_total


class ErrorData(_serialization.Model):
    """An error response from Azure.

    All required parameters must be populated in order to send to Azure.

    :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed
     programmatically. Required.
    :vartype code: str
    :ivar message: A message describing the error, intended to be suitable for displaying in a user
     interface. Required.
    :vartype message: str
    """

    _validation = {
        "code": {"required": True},
        "message": {"required": True},
    }

    _attribute_map = {
        "code": {"key": "code", "type": "str"},
        "message": {"key": "message", "type": "str"},
    }

    def __init__(self, *, code: str, message: str, **kwargs: Any) -> None:
        """
        :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed
         programmatically. Required.
        :paramtype code: str
        :keyword message: A message describing the error, intended to be suitable for displaying in a
         user interface. Required.
        :paramtype message: str
        """
        super().__init__(**kwargs)
        self.code = code
        self.message = message


class ItemDetails(_serialization.Model):
    """Item details. An item can be a job or a session.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    JobDetails, SessionDetails

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: The id of the item. Required.
    :vartype id: str
    :ivar name: The name of the item. It is not required for the name to be unique and it's only
     used for display purposes. Required.
    :vartype name: str
    :ivar provider_id: The unique identifier for the provider. Required.
    :vartype provider_id: str
    :ivar target: The target identifier to run the job. Required.
    :vartype target: str
    :ivar item_type: The type of item. Required. Known values are: "Job" and "Session".
    :vartype item_type: str or ~azure.quantum._client.models.ItemType
    :ivar creation_time: The creation time of the item.
    :vartype creation_time: ~datetime.datetime
    :ivar begin_execution_time: The time when the item began execution.
    :vartype begin_execution_time: ~datetime.datetime
    :ivar end_execution_time: The time when the item finished execution.
    :vartype end_execution_time: ~datetime.datetime
    :ivar cost_estimate: The job cost billed by the provider. The final cost on your bill might be
     slightly different due to added taxes and currency conversion rates.
    :vartype cost_estimate: ~azure.quantum._client.models.CostEstimate
    :ivar error_data: An error response from Azure.
    :vartype error_data: ~azure.quantum._client.models.ErrorData
    """

    _validation = {
        "id": {"required": True},
        "name": {"required": True},
        "provider_id": {"required": True},
        "target": {"required": True},
        "item_type": {"required": True},
        "creation_time": {"readonly": True},
        "begin_execution_time": {"readonly": True},
        "end_execution_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "provider_id": {"key": "providerId", "type": "str"},
        "target": {"key": "target", "type": "str"},
        "item_type": {"key": "itemType", "type": "str"},
        "creation_time": {"key": "creationTime", "type": "iso-8601"},
        "begin_execution_time": {"key": "beginExecutionTime", "type": "iso-8601"},
        "end_execution_time": {"key": "endExecutionTime", "type": "iso-8601"},
        "cost_estimate": {"key": "costEstimate", "type": "CostEstimate"},
        "error_data": {"key": "errorData", "type": "ErrorData"},
    }

    _subtype_map = {"item_type": {"Job": "JobDetails", "Session": "SessionDetails"}}

    def __init__(
        self,
        *,
        id: str,  # pylint: disable=redefined-builtin
        name: str,
        provider_id: str,
        target: str,
        cost_estimate: Optional["_models.CostEstimate"] = None,
        error_data: Optional["_models.ErrorData"] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword id: The id of the item. Required.
        :paramtype id: str
        :keyword name: The name of the item. It is not required for the name to be unique and it's only
         used for display purposes. Required.
        :paramtype name: str
        :keyword provider_id: The unique identifier for the provider. Required.
        :paramtype provider_id: str
        :keyword target: The target identifier to run the job. Required.
        :paramtype target: str
        :keyword cost_estimate: The job cost billed by the provider. The final cost on your bill might
         be slightly different due to added taxes and currency conversion rates.
        :paramtype cost_estimate: ~azure.quantum._client.models.CostEstimate
        :keyword error_data: An error response from Azure.
        :paramtype error_data: ~azure.quantum._client.models.ErrorData
        """
        super().__init__(**kwargs)
        self.id = id
        self.name = name
        self.provider_id = provider_id
        self.target = target
        self.item_type: Optional[str] = None
        self.creation_time = None
        self.begin_execution_time = None
        self.end_execution_time = None
        self.cost_estimate = cost_estimate
        self.error_data = error_data


class ItemDetailsList(_serialization.Model):
    """List of item details.

    All required parameters must be populated in order to send to Azure.

    :ivar value: Required.
    :vartype value: list[~azure.quantum._client.models.ItemDetails]
    :ivar next_link: Link to the next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ItemDetails]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, *, value: List["_models.ItemDetails"], next_link: Optional[str] = None, **kwargs: Any) -> None:
        """
        :keyword value: Required.
        :paramtype value: list[~azure.quantum._client.models.ItemDetails]
        :keyword next_link: Link to the next page of results.
        :paramtype next_link: str
        """
        super().__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class JobDetails(ItemDetails):  # pylint: disable=too-many-instance-attributes
    """Job details.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: The id of the item. Required.
    :vartype id: str
    :ivar name: The name of the item. It is not required for the name to be unique and it's only
     used for display purposes. Required.
    :vartype name: str
    :ivar provider_id: The unique identifier for the provider. Required.
    :vartype provider_id: str
    :ivar target: The target identifier to run the job. Required.
    :vartype target: str
    :ivar item_type: The type of item. Required. Known values are: "Job" and "Session".
    :vartype item_type: str or ~azure.quantum._client.models.ItemType
    :ivar creation_time: The creation time of the item.
    :vartype creation_time: ~datetime.datetime
    :ivar begin_execution_time: The time when the item began execution.
    :vartype begin_execution_time: ~datetime.datetime
    :ivar end_execution_time: The time when the item finished execution.
    :vartype end_execution_time: ~datetime.datetime
    :ivar cost_estimate: The job cost billed by the provider. The final cost on your bill might be
     slightly different due to added taxes and currency conversion rates.
    :vartype cost_estimate: ~azure.quantum._client.models.CostEstimate
    :ivar error_data: An error response from Azure.
    :vartype error_data: ~azure.quantum._client.models.ErrorData
    :ivar job_type: The type of job. Known values are: "Unknown", "QuantumComputing", and
     "Optimization".
    :vartype job_type: str or ~azure.quantum._client.models.JobType
    :ivar session_id: The ID of the session that the job is part of.
    :vartype session_id: str
    :ivar container_uri: The blob container SAS uri, the container is used to host job data.
     Required.
    :vartype container_uri: str
    :ivar input_data_uri: The input blob SAS uri, if specified, it will override the default input
     blob in the container.
    :vartype input_data_uri: str
    :ivar input_data_format: The format of the input data. Required.
    :vartype input_data_format: str
    :ivar input_params: The input parameters for the job. JSON object used by the target solver. It
     is expected that the size of this object is small and only used to specify parameters for the
     execution target, not the input data.
    :vartype input_params: JSON
    :ivar status: The status of the job. Known values are: "Waiting", "Executing", "Succeeded",
     "Failed", and "Cancelled".
    :vartype status: str or ~azure.quantum._client.models.JobStatus
    :ivar metadata: The job metadata. Metadata provides client the ability to store client-specific
     information.
    :vartype metadata: dict[str, str]
    :ivar output_data_uri: The output blob SAS uri. When a job finishes successfully, results will
     be uploaded to this blob.
    :vartype output_data_uri: str
    :ivar output_data_format: The format of the output data.
    :vartype output_data_format: str
    :ivar cancellation_time: The time when a job was successfully cancelled.
    :vartype cancellation_time: ~datetime.datetime
    :ivar quantum_computing_data: Quantum computing data.
    :vartype quantum_computing_data: ~azure.quantum._client.models.QuantumComputingData
    :ivar tags: List of user-supplied tags associated with the job.
    :vartype tags: list[str]
    """

    _validation = {
        "id": {"required": True},
        "name": {"required": True},
        "provider_id": {"required": True},
        "target": {"required": True},
        "item_type": {"required": True},
        "creation_time": {"readonly": True},
        "begin_execution_time": {"readonly": True},
        "end_execution_time": {"readonly": True},
        "job_type": {"readonly": True},
        "container_uri": {"required": True},
        "input_data_format": {"required": True},
        "status": {"readonly": True},
        "cancellation_time": {"readonly": True},
        "quantum_computing_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "provider_id": {"key": "providerId", "type": "str"},
        "target": {"key": "target", "type": "str"},
        "item_type": {"key": "itemType", "type": "str"},
        "creation_time": {"key": "creationTime", "type": "iso-8601"},
        "begin_execution_time": {"key": "beginExecutionTime", "type": "iso-8601"},
        "end_execution_time": {"key": "endExecutionTime", "type": "iso-8601"},
        "cost_estimate": {"key": "costEstimate", "type": "CostEstimate"},
        "error_data": {"key": "errorData", "type": "ErrorData"},
        "job_type": {"key": "jobType", "type": "str"},
        "session_id": {"key": "sessionId", "type": "str"},
        "container_uri": {"key": "containerUri", "type": "str"},
        "input_data_uri": {"key": "inputDataUri", "type": "str"},
        "input_data_format": {"key": "inputDataFormat", "type": "str"},
        "input_params": {"key": "inputParams", "type": "object"},
        "status": {"key": "status", "type": "str"},
        "metadata": {"key": "metadata", "type": "{str}"},
        "output_data_uri": {"key": "outputDataUri", "type": "str"},
        "output_data_format": {"key": "outputDataFormat", "type": "str"},
        "cancellation_time": {"key": "cancellationTime", "type": "iso-8601"},
        "quantum_computing_data": {"key": "quantumComputingData", "type": "QuantumComputingData"},
        "tags": {"key": "tags", "type": "[str]"},
    }

    def __init__(
        self,
        *,
        id: str,  # pylint: disable=redefined-builtin
        name: str,
        provider_id: str,
        target: str,
        container_uri: str,
        input_data_format: str,
        cost_estimate: Optional["_models.CostEstimate"] = None,
        error_data: Optional["_models.ErrorData"] = None,
        session_id: Optional[str] = None,
        input_data_uri: Optional[str] = None,
        input_params: Optional[JSON] = None,
        metadata: Optional[Dict[str, str]] = None,
        output_data_uri: Optional[str] = None,
        output_data_format: Optional[str] = None,
        tags: Optional[List[str]] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword id: The id of the item. Required.
        :paramtype id: str
        :keyword name: The name of the item. It is not required for the name to be unique and it's only
         used for display purposes. Required.
        :paramtype name: str
        :keyword provider_id: The unique identifier for the provider. Required.
        :paramtype provider_id: str
        :keyword target: The target identifier to run the job. Required.
        :paramtype target: str
        :keyword cost_estimate: The job cost billed by the provider. The final cost on your bill might
         be slightly different due to added taxes and currency conversion rates.
        :paramtype cost_estimate: ~azure.quantum._client.models.CostEstimate
        :keyword error_data: An error response from Azure.
        :paramtype error_data: ~azure.quantum._client.models.ErrorData
        :keyword session_id: The ID of the session that the job is part of.
        :paramtype session_id: str
        :keyword container_uri: The blob container SAS uri, the container is used to host job data.
         Required.
        :paramtype container_uri: str
        :keyword input_data_uri: The input blob SAS uri, if specified, it will override the default
         input blob in the container.
        :paramtype input_data_uri: str
        :keyword input_data_format: The format of the input data. Required.
        :paramtype input_data_format: str
        :keyword input_params: The input parameters for the job. JSON object used by the target solver.
         It is expected that the size of this object is small and only used to specify parameters for
         the execution target, not the input data.
        :paramtype input_params: JSON
        :keyword metadata: The job metadata. Metadata provides client the ability to store
         client-specific information.
        :paramtype metadata: dict[str, str]
        :keyword output_data_uri: The output blob SAS uri. When a job finishes successfully, results
         will be uploaded to this blob.
        :paramtype output_data_uri: str
        :keyword output_data_format: The format of the output data.
        :paramtype output_data_format: str
        :keyword tags: List of user-supplied tags associated with the job.
        :paramtype tags: list[str]
        """
        super().__init__(
            id=id,
            name=name,
            provider_id=provider_id,
            target=target,
            cost_estimate=cost_estimate,
            error_data=error_data,
            **kwargs
        )
        self.item_type: str = "Job"
        self.job_type = None
        self.session_id = session_id
        self.container_uri = container_uri
        self.input_data_uri = input_data_uri
        self.input_data_format = input_data_format
        self.input_params = input_params
        self.status = None
        self.metadata = metadata
        self.output_data_uri = output_data_uri
        self.output_data_format = output_data_format
        self.cancellation_time = None
        self.quantum_computing_data = None
        self.tags = tags


class JobDetailsList(_serialization.Model):
    """List of job details.

    :ivar value:
    :vartype value: list[~azure.quantum._client.models.JobDetails]
    :ivar next_link: Link to the next page of results.
    :vartype next_link: str
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[JobDetails]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(
        self, *, value: Optional[List["_models.JobDetails"]] = None, next_link: Optional[str] = None, **kwargs: Any
    ) -> None:
        """
        :keyword value:
        :paramtype value: list[~azure.quantum._client.models.JobDetails]
        :keyword next_link: Link to the next page of results.
        :paramtype next_link: str
        """
        super().__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class JsonPatchDocument(_serialization.Model):
    """A JSONPatch document as defined by RFC 6902.

    All required parameters must be populated in order to send to Azure.

    :ivar op: The operation to be performed. Required. Known values are: "add", "remove",
     "replace", "move", "copy", and "test".
    :vartype op: str or ~azure.quantum._client.models.JsonPatchOperation
    :ivar path: A JSON-Pointer. Required.
    :vartype path: str
    :ivar value: A value to be used in the operation on the path.
    :vartype value: JSON
    :ivar from_property: Optional field used in copy and move operations.
    :vartype from_property: str
    """

    _validation = {
        "op": {"required": True},
        "path": {"required": True},
    }

    _attribute_map = {
        "op": {"key": "op", "type": "str"},
        "path": {"key": "path", "type": "str"},
        "value": {"key": "value", "type": "object"},
        "from_property": {"key": "from", "type": "str"},
    }

    def __init__(
        self,
        *,
        op: Union[str, "_models.JsonPatchOperation"],
        path: str,
        value: Optional[JSON] = None,
        from_property: Optional[str] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword op: The operation to be performed. Required. Known values are: "add", "remove",
         "replace", "move", "copy", and "test".
        :paramtype op: str or ~azure.quantum._client.models.JsonPatchOperation
        :keyword path: A JSON-Pointer. Required.
        :paramtype path: str
        :keyword value: A value to be used in the operation on the path.
        :paramtype value: JSON
        :keyword from_property: Optional field used in copy and move operations.
        :paramtype from_property: str
        """
        super().__init__(**kwargs)
        self.op = op
        self.path = path
        self.value = value
        self.from_property = from_property


class ProviderStatus(_serialization.Model):
    """Providers status.

    :ivar id: Provider id.
    :vartype id: str
    :ivar current_availability: Provider availability. Known values are: "Available", "Degraded",
     and "Unavailable".
    :vartype current_availability: str or ~azure.quantum._client.models.ProviderAvailability
    :ivar targets:
    :vartype targets: list[~azure.quantum._client.models.TargetStatus]
    """

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "current_availability": {"key": "currentAvailability", "type": "str"},
        "targets": {"key": "targets", "type": "[TargetStatus]"},
    }

    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        current_availability: Optional[Union[str, "_models.ProviderAvailability"]] = None,
        targets: Optional[List["_models.TargetStatus"]] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword id: Provider id.
        :paramtype id: str
        :keyword current_availability: Provider availability. Known values are: "Available",
         "Degraded", and "Unavailable".
        :paramtype current_availability: str or ~azure.quantum._client.models.ProviderAvailability
        :keyword targets:
        :paramtype targets: list[~azure.quantum._client.models.TargetStatus]
        """
        super().__init__(**kwargs)
        self.id = id
        self.current_availability = current_availability
        self.targets = targets


class ProviderStatusList(_serialization.Model):
    """Providers status.

    :ivar value:
    :vartype value: list[~azure.quantum._client.models.ProviderStatus]
    :ivar next_link: Link to the next page of results.
    :vartype next_link: str
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[ProviderStatus]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(
        self, *, value: Optional[List["_models.ProviderStatus"]] = None, next_link: Optional[str] = None, **kwargs: Any
    ) -> None:
        """
        :keyword value:
        :paramtype value: list[~azure.quantum._client.models.ProviderStatus]
        :keyword next_link: Link to the next page of results.
        :paramtype next_link: str
        """
        super().__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class QuantumComputingData(_serialization.Model):
    """Quantum computing data.

    :ivar count: The number of quantum computing items in the job.
    :vartype count: int
    """

    _attribute_map = {
        "count": {"key": "count", "type": "int"},
    }

    def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None:
        """
        :keyword count: The number of quantum computing items in the job.
        :paramtype count: int
        """
        super().__init__(**kwargs)
        self.count = count


class Quota(_serialization.Model):
    """Quota information.

    :ivar dimension: The name of the dimension associated with the quota.
    :vartype dimension: str
    :ivar scope: The scope at which the quota is applied. Known values are: "Workspace" and
     "Subscription".
    :vartype scope: str or ~azure.quantum._client.models.DimensionScope
    :ivar provider_id: The unique identifier for the provider.
    :vartype provider_id: str
    :ivar utilization: The amount of the usage that has been applied for the current period.
    :vartype utilization: float
    :ivar holds: The amount of the usage that has been reserved but not applied for the current
     period.
    :vartype holds: float
    :ivar limit: The maximum amount of usage allowed for the current period.
    :vartype limit: float
    :ivar period: The time period in which the quota's underlying meter is accumulated. Based on
     calendar year. 'None' is used for concurrent quotas. Known values are: "None" and "Monthly".
    :vartype period: str or ~azure.quantum._client.models.MeterPeriod
    """

    _attribute_map = {
        "dimension": {"key": "dimension", "type": "str"},
        "scope": {"key": "scope", "type": "str"},
        "provider_id": {"key": "providerId", "type": "str"},
        "utilization": {"key": "utilization", "type": "float"},
        "holds": {"key": "holds", "type": "float"},
        "limit": {"key": "limit", "type": "float"},
        "period": {"key": "period", "type": "str"},
    }

    def __init__(
        self,
        *,
        dimension: Optional[str] = None,
        scope: Optional[Union[str, "_models.DimensionScope"]] = None,
        provider_id: Optional[str] = None,
        utilization: Optional[float] = None,
        holds: Optional[float] = None,
        limit: Optional[float] = None,
        period: Optional[Union[str, "_models.MeterPeriod"]] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword dimension: The name of the dimension associated with the quota.
        :paramtype dimension: str
        :keyword scope: The scope at which the quota is applied. Known values are: "Workspace" and
         "Subscription".
        :paramtype scope: str or ~azure.quantum._client.models.DimensionScope
        :keyword provider_id: The unique identifier for the provider.
        :paramtype provider_id: str
        :keyword utilization: The amount of the usage that has been applied for the current period.
        :paramtype utilization: float
        :keyword holds: The amount of the usage that has been reserved but not applied for the current
         period.
        :paramtype holds: float
        :keyword limit: The maximum amount of usage allowed for the current period.
        :paramtype limit: float
        :keyword period: The time period in which the quota's underlying meter is accumulated. Based on
         calendar year. 'None' is used for concurrent quotas. Known values are: "None" and "Monthly".
        :paramtype period: str or ~azure.quantum._client.models.MeterPeriod
        """
        super().__init__(**kwargs)
        self.dimension = dimension
        self.scope = scope
        self.provider_id = provider_id
        self.utilization = utilization
        self.holds = holds
        self.limit = limit
        self.period = period


class QuotaList(_serialization.Model):
    """List of quotas.

    :ivar value:
    :vartype value: list[~azure.quantum._client.models.Quota]
    :ivar next_link: Link to the next page of results.
    :vartype next_link: str
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[Quota]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(
        self, *, value: Optional[List["_models.Quota"]] = None, next_link: Optional[str] = None, **kwargs: Any
    ) -> None:
        """
        :keyword value:
        :paramtype value: list[~azure.quantum._client.models.Quota]
        :keyword next_link: Link to the next page of results.
        :paramtype next_link: str
        """
        super().__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class RestError(_serialization.Model):
    """Error information returned by the API.

    All required parameters must be populated in order to send to Azure.

    :ivar error: An error response from Azure. Required.
    :vartype error: ~azure.quantum._client.models.ErrorData
    """

    _validation = {
        "error": {"required": True},
    }

    _attribute_map = {
        "error": {"key": "error", "type": "ErrorData"},
    }

    def __init__(self, *, error: "_models.ErrorData", **kwargs: Any) -> None:
        """
        :keyword error: An error response from Azure. Required.
        :paramtype error: ~azure.quantum._client.models.ErrorData
        """
        super().__init__(**kwargs)
        self.error = error


class SasUriResponse(_serialization.Model):
    """Get SAS URL operation response.

    :ivar sas_uri: A URL with a SAS token to upload a blob for execution in the given workspace.
    :vartype sas_uri: str
    """

    _attribute_map = {
        "sas_uri": {"key": "sasUri", "type": "str"},
    }

    def __init__(self, *, sas_uri: Optional[str] = None, **kwargs: Any) -> None:
        """
        :keyword sas_uri: A URL with a SAS token to upload a blob for execution in the given workspace.
        :paramtype sas_uri: str
        """
        super().__init__(**kwargs)
        self.sas_uri = sas_uri


class SessionDetails(ItemDetails):  # pylint: disable=too-many-instance-attributes
    """Session details.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: The id of the item. Required.
    :vartype id: str
    :ivar name: The name of the item. It is not required for the name to be unique and it's only
     used for display purposes. Required.
    :vartype name: str
    :ivar provider_id: The unique identifier for the provider. Required.
    :vartype provider_id: str
    :ivar target: The target identifier to run the job. Required.
    :vartype target: str
    :ivar item_type: The type of item. Required. Known values are: "Job" and "Session".
    :vartype item_type: str or ~azure.quantum._client.models.ItemType
    :ivar creation_time: The creation time of the item.
    :vartype creation_time: ~datetime.datetime
    :ivar begin_execution_time: The time when the item began execution.
    :vartype begin_execution_time: ~datetime.datetime
    :ivar end_execution_time: The time when the item finished execution.
    :vartype end_execution_time: ~datetime.datetime
    :ivar cost_estimate: The job cost billed by the provider. The final cost on your bill might be
     slightly different due to added taxes and currency conversion rates.
    :vartype cost_estimate: ~azure.quantum._client.models.CostEstimate
    :ivar error_data: An error response from Azure.
    :vartype error_data: ~azure.quantum._client.models.ErrorData
    :ivar job_failure_policy: Policy controlling the behavior of the Session when a job in the
     session fails. Known values are: "Abort" and "Continue".
    :vartype job_failure_policy: str or ~azure.quantum._client.models.SessionJobFailurePolicy
    :ivar status: The status of the session. Known values are: "Waiting", "Executing", "Succeeded",
     "Failed", "Failure(s)", and "TimedOut".
    :vartype status: str or ~azure.quantum._client.models.SessionStatus
    """

    _validation = {
        "id": {"required": True},
        "name": {"required": True},
        "provider_id": {"required": True},
        "target": {"required": True},
        "item_type": {"required": True},
        "creation_time": {"readonly": True},
        "begin_execution_time": {"readonly": True},
        "end_execution_time": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "provider_id": {"key": "providerId", "type": "str"},
        "target": {"key": "target", "type": "str"},
        "item_type": {"key": "itemType", "type": "str"},
        "creation_time": {"key": "creationTime", "type": "iso-8601"},
        "begin_execution_time": {"key": "beginExecutionTime", "type": "iso-8601"},
        "end_execution_time": {"key": "endExecutionTime", "type": "iso-8601"},
        "cost_estimate": {"key": "costEstimate", "type": "CostEstimate"},
        "error_data": {"key": "errorData", "type": "ErrorData"},
        "job_failure_policy": {"key": "jobFailurePolicy", "type": "str"},
        "status": {"key": "status", "type": "str"},
    }

    def __init__(
        self,
        *,
        id: str,  # pylint: disable=redefined-builtin
        name: str,
        provider_id: str,
        target: str,
        cost_estimate: Optional["_models.CostEstimate"] = None,
        error_data: Optional["_models.ErrorData"] = None,
        job_failure_policy: Union[str, "_models.SessionJobFailurePolicy"] = "Abort",
        **kwargs: Any
    ) -> None:
        """
        :keyword id: The id of the item. Required.
        :paramtype id: str
        :keyword name: The name of the item. It is not required for the name to be unique and it's only
         used for display purposes. Required.
        :paramtype name: str
        :keyword provider_id: The unique identifier for the provider. Required.
        :paramtype provider_id: str
        :keyword target: The target identifier to run the job. Required.
        :paramtype target: str
        :keyword cost_estimate: The job cost billed by the provider. The final cost on your bill might
         be slightly different due to added taxes and currency conversion rates.
        :paramtype cost_estimate: ~azure.quantum._client.models.CostEstimate
        :keyword error_data: An error response from Azure.
        :paramtype error_data: ~azure.quantum._client.models.ErrorData
        :keyword job_failure_policy: Policy controlling the behavior of the Session when a job in the
         session fails. Known values are: "Abort" and "Continue".
        :paramtype job_failure_policy: str or ~azure.quantum._client.models.SessionJobFailurePolicy
        """
        super().__init__(
            id=id,
            name=name,
            provider_id=provider_id,
            target=target,
            cost_estimate=cost_estimate,
            error_data=error_data,
            **kwargs
        )
        self.item_type: str = "Session"
        self.job_failure_policy = job_failure_policy
        self.status = None


class SessionDetailsList(_serialization.Model):
    """List of session details.

    :ivar value:
    :vartype value: list[~azure.quantum._client.models.SessionDetails]
    :ivar next_link: Link to the next page of results.
    :vartype next_link: str
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[SessionDetails]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(
        self, *, value: Optional[List["_models.SessionDetails"]] = None, next_link: Optional[str] = None, **kwargs: Any
    ) -> None:
        """
        :keyword value:
        :paramtype value: list[~azure.quantum._client.models.SessionDetails]
        :keyword next_link: Link to the next page of results.
        :paramtype next_link: str
        """
        super().__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class TargetStatus(_serialization.Model):
    """Target status.

    :ivar id: Target id.
    :vartype id: str
    :ivar current_availability: Target availability. Known values are: "Available", "Degraded", and
     "Unavailable".
    :vartype current_availability: str or ~azure.quantum._client.models.TargetAvailability
    :ivar average_queue_time: Average queue time in seconds.
    :vartype average_queue_time: int
    :ivar status_page: A page with detailed status of the provider.
    :vartype status_page: str
    """

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "current_availability": {"key": "currentAvailability", "type": "str"},
        "average_queue_time": {"key": "averageQueueTime", "type": "int"},
        "status_page": {"key": "statusPage", "type": "str"},
    }

    def __init__(
        self,
        *,
        id: Optional[str] = None,  # pylint: disable=redefined-builtin
        current_availability: Optional[Union[str, "_models.TargetAvailability"]] = None,
        average_queue_time: Optional[int] = None,
        status_page: Optional[str] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword id: Target id.
        :paramtype id: str
        :keyword current_availability: Target availability. Known values are: "Available", "Degraded",
         and "Unavailable".
        :paramtype current_availability: str or ~azure.quantum._client.models.TargetAvailability
        :keyword average_queue_time: Average queue time in seconds.
        :paramtype average_queue_time: int
        :keyword status_page: A page with detailed status of the provider.
        :paramtype status_page: str
        """
        super().__init__(**kwargs)
        self.id = id
        self.current_availability = current_availability
        self.average_queue_time = average_queue_time
        self.status_page = status_page


class UsageEvent(_serialization.Model):
    """Usage event details.

    :ivar dimension_id: The dimension id.
    :vartype dimension_id: str
    :ivar dimension_name: The dimension name.
    :vartype dimension_name: str
    :ivar measure_unit: The unit of measure.
    :vartype measure_unit: str
    :ivar amount_billed: The amount billed.
    :vartype amount_billed: float
    :ivar amount_consumed: The amount consumed.
    :vartype amount_consumed: float
    :ivar unit_price: The unit price.
    :vartype unit_price: float
    """

    _attribute_map = {
        "dimension_id": {"key": "dimensionId", "type": "str"},
        "dimension_name": {"key": "dimensionName", "type": "str"},
        "measure_unit": {"key": "measureUnit", "type": "str"},
        "amount_billed": {"key": "amountBilled", "type": "float"},
        "amount_consumed": {"key": "amountConsumed", "type": "float"},
        "unit_price": {"key": "unitPrice", "type": "float"},
    }

    def __init__(
        self,
        *,
        dimension_id: Optional[str] = None,
        dimension_name: Optional[str] = None,
        measure_unit: Optional[str] = None,
        amount_billed: Optional[float] = None,
        amount_consumed: Optional[float] = None,
        unit_price: Optional[float] = None,
        **kwargs: Any
    ) -> None:
        """
        :keyword dimension_id: The dimension id.
        :paramtype dimension_id: str
        :keyword dimension_name: The dimension name.
        :paramtype dimension_name: str
        :keyword measure_unit: The unit of measure.
        :paramtype measure_unit: str
        :keyword amount_billed: The amount billed.
        :paramtype amount_billed: float
        :keyword amount_consumed: The amount consumed.
        :paramtype amount_consumed: float
        :keyword unit_price: The unit price.
        :paramtype unit_price: float
        """
        super().__init__(**kwargs)
        self.dimension_id = dimension_id
        self.dimension_name = dimension_name
        self.measure_unit = measure_unit
        self.amount_billed = amount_billed
        self.amount_consumed = amount_consumed
        self.unit_price = unit_price
