# 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.
# --------------------------------------------------------------------------

import datetime
from typing import Dict, List, Optional, Union

from azure.core.exceptions import HttpResponseError
import msrest.serialization

from ._footprint_monitoring_management_client_enums import *


class DefaultErrorResponse(msrest.serialization.Model):
    """The base response with an error.

    :param error: The error details, if any.
    :type error: ~footprint_monitoring_management_client.models.ErrorDefinition
    """

    _attribute_map = {
        'error': {'key': 'error', 'type': 'ErrorDefinition'},
    }

    def __init__(
        self,
        *,
        error: Optional["ErrorDefinition"] = None,
        **kwargs
    ):
        super(DefaultErrorResponse, self).__init__(**kwargs)
        self.error = error


class ErrorDefinition(msrest.serialization.Model):
    """The details of an error.

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

    :ivar code: Service specific error code which serves as the substatus for the HTTP error code.
    :vartype code: str
    :ivar message: Description of the error.
    :vartype message: str
    """

    _validation = {
        'code': {'readonly': True},
        'message': {'readonly': True},
    }

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

    def __init__(
        self,
        **kwargs
    ):
        super(ErrorDefinition, self).__init__(**kwargs)
        self.code = None
        self.message = None


class SubResource(msrest.serialization.Model):
    """An Azure resource that is child to another Azure resource.

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

    :ivar id: Fully qualified resource Id for the resource.
    :vartype id: str
    """

    _validation = {
        'id': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(SubResource, self).__init__(**kwargs)
        self.id = None


class Experiment(SubResource):
    """A model representing the Footprint experiment.

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

    :ivar id: Fully qualified resource Id for the resource.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource.
    :vartype type: str
    :ivar experiment_id: The id of a Footprint experiment.
    :vartype experiment_id: str
    :param description: The description of a Footprint experiment.
    :type description: str
    :ivar status: The status of a Footprint experiment.
    :vartype status: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'experiment_id': {'readonly': True, 'max_length': 32, 'min_length': 32, 'pattern': r'[a-f0-9]{32}'},
        'status': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'experiment_id': {'key': 'properties.experimentId', 'type': 'str'},
        'description': {'key': 'properties.description', 'type': 'str'},
        'status': {'key': 'properties.status', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        description: Optional[str] = None,
        **kwargs
    ):
        super(Experiment, self).__init__(**kwargs)
        self.name = None
        self.type = None
        self.experiment_id = None
        self.description = description
        self.status = None


class ExperimentList(msrest.serialization.Model):
    """Result of the request to list Footprint experiments. It contains a list of Footprint experiments objects and a URL link to get the next set of results.

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

    :ivar value: A collection of Footprint experiments.
    :vartype value: list[~footprint_monitoring_management_client.models.Experiment]
    :param next_link: URL to get the next set of Footprint experiment objects if there are any.
    :type next_link: str
    """

    _validation = {
        'value': {'readonly': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[Experiment]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(ExperimentList, self).__init__(**kwargs)
        self.value = None
        self.next_link = next_link


class MeasurementEndpoint(SubResource):
    """A model representing a Footprint measurement endpoint.

    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: Fully qualified resource Id for the resource.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource.
    :vartype type: str
    :ivar endpoint_id: The id of a measurement endpoint.
    :vartype endpoint_id: str
    :param description: The description of a measurement endpoint.
    :type description: str
    :param endpoint: Required. The value of a measurement endpoint.
    :type endpoint: str
    :param measurement_type: Required. The type of a measurement endpoint.
    :type measurement_type: int
    :param weight: Required. The weight of a measurement endpoint, higher weight means higher
     priority.
    :type weight: int
    :param experiment_id: The id of an experiment that a measurement endpoint is part of.
    :type experiment_id: str
    :param object_path: The path of the object that a measurement endpoint points to.
    :type object_path: str
    :ivar conditions: The conditions of a measurement endpoint.
    :vartype conditions: list[~footprint_monitoring_management_client.models.SubResource]
    :param start_time_utc: The start time that a measurement endpoint should be served.
    :type start_time_utc: ~datetime.datetime
    :param end_time_utc: The end time that a measurement endpoint should be served.
    :type end_time_utc: ~datetime.datetime
    :param hot_path_sampling_percentage_rate: The percentual sampling rate for the hot path logging
     of a measurement endpoint.
    :type hot_path_sampling_percentage_rate: float
    :param warm_path_sampling_percentage_rate: The percentual sampling rate for the warm path
     logging of a measurement endpoint.
    :type warm_path_sampling_percentage_rate: float
    :param cold_path_sampling_percentage_rate_override: The percentual sampling rate for the cold
     path logging of a measurement endpoint.
    :type cold_path_sampling_percentage_rate_override: float
    :param metadata: The metadata of a measurement endpoint.
    :type metadata: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'endpoint_id': {'readonly': True, 'max_length': 32, 'min_length': 32, 'pattern': r'[a-f0-9]{32}'},
        'endpoint': {'required': True, 'max_length': 1024, 'min_length': 0, 'pattern': r'^[a-z0-9\*]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?$'},
        'measurement_type': {'required': True},
        'weight': {'required': True, 'maximum': 2147483647, 'minimum': 0},
        'experiment_id': {'max_length': 32, 'min_length': 32, 'pattern': r'[a-f0-9]{32}'},
        'object_path': {'max_length': 1024, 'min_length': 0, 'pattern': r'^/[a-zA-Z0-9-._~%!$&()*+,;=@/]*$'},
        'conditions': {'readonly': True},
        'hot_path_sampling_percentage_rate': {'maximum': 100, 'minimum': 0},
        'warm_path_sampling_percentage_rate': {'maximum': 100, 'minimum': 0},
        'cold_path_sampling_percentage_rate_override': {'maximum': 100, 'minimum': 0},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'endpoint_id': {'key': 'properties.endpointId', 'type': 'str'},
        'description': {'key': 'properties.description', 'type': 'str'},
        'endpoint': {'key': 'properties.endpoint', 'type': 'str'},
        'measurement_type': {'key': 'properties.measurementType', 'type': 'int'},
        'weight': {'key': 'properties.weight', 'type': 'int'},
        'experiment_id': {'key': 'properties.experimentId', 'type': 'str'},
        'object_path': {'key': 'properties.objectPath', 'type': 'str'},
        'conditions': {'key': 'properties.conditions', 'type': '[SubResource]'},
        'start_time_utc': {'key': 'properties.startTimeUTC', 'type': 'iso-8601'},
        'end_time_utc': {'key': 'properties.endTimeUTC', 'type': 'iso-8601'},
        'hot_path_sampling_percentage_rate': {'key': 'properties.hotPathSamplingPercentageRate', 'type': 'float'},
        'warm_path_sampling_percentage_rate': {'key': 'properties.warmPathSamplingPercentageRate', 'type': 'float'},
        'cold_path_sampling_percentage_rate_override': {'key': 'properties.coldPathSamplingPercentageRateOverride', 'type': 'float'},
        'metadata': {'key': 'properties.metadata', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        endpoint: str,
        measurement_type: int,
        weight: int,
        description: Optional[str] = None,
        experiment_id: Optional[str] = None,
        object_path: Optional[str] = None,
        start_time_utc: Optional[datetime.datetime] = None,
        end_time_utc: Optional[datetime.datetime] = None,
        hot_path_sampling_percentage_rate: Optional[float] = None,
        warm_path_sampling_percentage_rate: Optional[float] = None,
        cold_path_sampling_percentage_rate_override: Optional[float] = None,
        metadata: Optional[str] = None,
        **kwargs
    ):
        super(MeasurementEndpoint, self).__init__(**kwargs)
        self.name = None
        self.type = None
        self.endpoint_id = None
        self.description = description
        self.endpoint = endpoint
        self.measurement_type = measurement_type
        self.weight = weight
        self.experiment_id = experiment_id
        self.object_path = object_path
        self.conditions = None
        self.start_time_utc = start_time_utc
        self.end_time_utc = end_time_utc
        self.hot_path_sampling_percentage_rate = hot_path_sampling_percentage_rate
        self.warm_path_sampling_percentage_rate = warm_path_sampling_percentage_rate
        self.cold_path_sampling_percentage_rate_override = cold_path_sampling_percentage_rate_override
        self.metadata = metadata


class MeasurementEndpointCondition(SubResource):
    """A model representing the Footprint measurement endpoint condition.

    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: Fully qualified resource Id for the resource.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource.
    :vartype type: str
    :ivar condition_id: The id of a Footprint measurement endpoint condition.
    :vartype condition_id: str
    :param type_properties_type: Required. The type of a Footprint measurement endpoint condition.
     Possible values include: "RequestHeader".
    :type type_properties_type: str or ~footprint_monitoring_management_client.models.Type
    :param variable: Required. The variable of a Footprint measurement endpoint condition.
    :type variable: str
    :param operator: Required. The operator of a Footprint measurement endpoint condition. Possible
     values include: "IsExactValue", "MatchValueIgnoreCasing", "ContainsValue",
     "ContainsValueIgnoreCasing", "DoesNotContainValue", "DoesNotContainValueIgnoreCasing".
    :type operator: str or ~footprint_monitoring_management_client.models.Operator
    :param constant: Required. The constant of a Footprint measurement endpoint condition.
    :type constant: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'condition_id': {'readonly': True, 'max_length': 32, 'min_length': 32, 'pattern': r'[a-f0-9]{32}'},
        'type_properties_type': {'required': True},
        'variable': {'required': True},
        'operator': {'required': True},
        'constant': {'required': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'condition_id': {'key': 'properties.conditionId', 'type': 'str'},
        'type_properties_type': {'key': 'properties.type', 'type': 'str'},
        'variable': {'key': 'properties.variable', 'type': 'str'},
        'operator': {'key': 'properties.operator', 'type': 'str'},
        'constant': {'key': 'properties.constant', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        type_properties_type: Union[str, "Type"],
        variable: str,
        operator: Union[str, "Operator"],
        constant: str,
        **kwargs
    ):
        super(MeasurementEndpointCondition, self).__init__(**kwargs)
        self.name = None
        self.type = None
        self.condition_id = None
        self.type_properties_type = type_properties_type
        self.variable = variable
        self.operator = operator
        self.constant = constant


class MeasurementEndpointConditionList(msrest.serialization.Model):
    """Result of the request to list Footprint measurement endpoint contidions. It contains a list of Footprint measurement endpoint contidions objects and a URL link to get the next set of results.

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

    :ivar value: A collection of Footprint measurement endpoint contidions.
    :vartype value:
     list[~footprint_monitoring_management_client.models.MeasurementEndpointCondition]
    :param next_link: URL to get the next set of Footprint measurement endpoint contidion objects
     if there are any.
    :type next_link: str
    """

    _validation = {
        'value': {'readonly': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[MeasurementEndpointCondition]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(MeasurementEndpointConditionList, self).__init__(**kwargs)
        self.value = None
        self.next_link = next_link


class MeasurementEndpointList(msrest.serialization.Model):
    """Result of the request to list Footprint measurement endpoints. It contains a list of Footprint measurement endpoints objects and a URL link to get the next set of results.

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

    :ivar value: A collection of Footprint measurement endpoints.
    :vartype value: list[~footprint_monitoring_management_client.models.MeasurementEndpoint]
    :param next_link: URL to get the next set of Footprint measurement endpoints objects if there
     are any.
    :type next_link: str
    """

    _validation = {
        'value': {'readonly': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[MeasurementEndpoint]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(MeasurementEndpointList, self).__init__(**kwargs)
        self.value = None
        self.next_link = next_link


class Resource(msrest.serialization.Model):
    """An Azure resource.

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

    :ivar id: Fully qualified resource Id for the resource.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource.
    :vartype type: str
    :param tags: A set of tags. Tags for the resource.
    :type tags: dict[str, str]
    :param location: Region where the Azure resource is located.
    :type location: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
        'location': {'key': 'location', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        location: Optional[str] = None,
        **kwargs
    ):
        super(Resource, self).__init__(**kwargs)
        self.id = None
        self.name = None
        self.type = None
        self.tags = tags
        self.location = location


class Profile(Resource):
    """The Footprint profile resource.

    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: Fully qualified resource Id for the resource.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource.
    :vartype type: str
    :param tags: A set of tags. Tags for the resource.
    :type tags: dict[str, str]
    :param location: Region where the Azure resource is located.
    :type location: str
    :ivar provisioning_state: The provisioned state of the resource. Possible values include:
     "Succeeded", "Failed", "Cancelled", "Updating", "Deleting".
    :vartype provisioning_state: str or
     ~footprint_monitoring_management_client.models.ProvisioningState
    :ivar profile_id: The id of the Footprint profile.
    :vartype profile_id: str
    :param description: The description of the Footprint profile.
    :type description: str
    :param start_delay_milliseconds: Required. The delay in milliseconds that the clients should
     wait for until they start performing measurements.
    :type start_delay_milliseconds: int
    :ivar script_uri: The URL where the script for the Footprint profile.
    :vartype script_uri: str
    :param measurement_count: Required. The number of measurements to perform.
    :type measurement_count: int
    :param cold_path_sampling_percentage_rate: The default sampling percentage for cold path
     measurement storage.
    :type cold_path_sampling_percentage_rate: float
    :ivar measurement_endpoints: The endpoints which to perform measurements to.
    :vartype measurement_endpoints:
     list[~footprint_monitoring_management_client.models.SubResource]
    :param reporting_endpoints: The endpoints which to upload measurements to.
    :type reporting_endpoints: list[str]
    :ivar experiments: The experiments currently associated to this Footprint profile.
    :vartype experiments: list[~footprint_monitoring_management_client.models.SubResource]
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'provisioning_state': {'readonly': True},
        'profile_id': {'readonly': True},
        'start_delay_milliseconds': {'required': True, 'maximum': 3600000, 'minimum': 0},
        'script_uri': {'readonly': True},
        'measurement_count': {'required': True, 'minimum': 0},
        'cold_path_sampling_percentage_rate': {'maximum': 100, 'minimum': 0},
        'measurement_endpoints': {'readonly': True},
        'experiments': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
        'location': {'key': 'location', 'type': 'str'},
        'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
        'profile_id': {'key': 'properties.profileId', 'type': 'str'},
        'description': {'key': 'properties.description', 'type': 'str'},
        'start_delay_milliseconds': {'key': 'properties.startDelayMilliseconds', 'type': 'int'},
        'script_uri': {'key': 'properties.scriptUri', 'type': 'str'},
        'measurement_count': {'key': 'properties.measurementCount', 'type': 'int'},
        'cold_path_sampling_percentage_rate': {'key': 'properties.coldPathSamplingPercentageRate', 'type': 'float'},
        'measurement_endpoints': {'key': 'properties.measurementEndpoints', 'type': '[SubResource]'},
        'reporting_endpoints': {'key': 'properties.reportingEndpoints', 'type': '[str]'},
        'experiments': {'key': 'properties.experiments', 'type': '[SubResource]'},
    }

    def __init__(
        self,
        *,
        start_delay_milliseconds: int,
        measurement_count: int,
        tags: Optional[Dict[str, str]] = None,
        location: Optional[str] = None,
        description: Optional[str] = None,
        cold_path_sampling_percentage_rate: Optional[float] = None,
        reporting_endpoints: Optional[List[str]] = None,
        **kwargs
    ):
        super(Profile, self).__init__(tags=tags, location=location, **kwargs)
        self.provisioning_state = None
        self.profile_id = None
        self.description = description
        self.start_delay_milliseconds = start_delay_milliseconds
        self.script_uri = None
        self.measurement_count = measurement_count
        self.cold_path_sampling_percentage_rate = cold_path_sampling_percentage_rate
        self.measurement_endpoints = None
        self.reporting_endpoints = reporting_endpoints
        self.experiments = None


class ProfileList(msrest.serialization.Model):
    """Result of the request to list Footprint profiles. It contains a list of Footprint profile objects and a URL link to get the next set of results.

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

    :ivar value: A collection of Footprint profiles.
    :vartype value: list[~footprint_monitoring_management_client.models.Profile]
    :param next_link: URL to get the next set of Footprint profile objects if there are any.
    :type next_link: str
    """

    _validation = {
        'value': {'readonly': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[Profile]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(ProfileList, self).__init__(**kwargs)
        self.value = None
        self.next_link = next_link


class ProfilePatch(msrest.serialization.Model):
    """The model for patches on Footprint profile resources.

    :param tags: A set of tags. The tags for this resource.
    :type tags: dict[str, str]
    """

    _attribute_map = {
        'tags': {'key': 'tags', 'type': '{str}'},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        **kwargs
    ):
        super(ProfilePatch, self).__init__(**kwargs)
        self.tags = tags


class ResourceProviderOperationDefinition(msrest.serialization.Model):
    """Describes the Resource Provider Operation.

    :param name: Resource provider operation name.
    :type name: str
    :param display: Resource provider display properties.
    :type display: ~footprint_monitoring_management_client.models.ResourceProviderOperationDisplay
    """

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'},
    }

    def __init__(
        self,
        *,
        name: Optional[str] = None,
        display: Optional["ResourceProviderOperationDisplay"] = None,
        **kwargs
    ):
        super(ResourceProviderOperationDefinition, self).__init__(**kwargs)
        self.name = name
        self.display = display


class ResourceProviderOperationDisplay(msrest.serialization.Model):
    """Describes the properties of the Operation.

    :param provider: Name of the resource provider.
    :type provider: str
    :param resource: Name of the resource type.
    :type resource: str
    :param operation: Name of the resource provider operation.
    :type operation: str
    :param description: Description of the resource provider operation.
    :type description: str
    """

    _attribute_map = {
        'provider': {'key': 'provider', 'type': 'str'},
        'resource': {'key': 'resource', 'type': 'str'},
        'operation': {'key': 'operation', 'type': 'str'},
        'description': {'key': 'description', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        provider: Optional[str] = None,
        resource: Optional[str] = None,
        operation: Optional[str] = None,
        description: Optional[str] = None,
        **kwargs
    ):
        super(ResourceProviderOperationDisplay, self).__init__(**kwargs)
        self.provider = provider
        self.resource = resource
        self.operation = operation
        self.description = description


class ResourceProviderOperationList(msrest.serialization.Model):
    """A list of operations and a URL nextLink to get the next set of results.

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

    :param value: Resource provider operations list.
    :type value:
     list[~footprint_monitoring_management_client.models.ResourceProviderOperationDefinition]
    :ivar next_link: The URI that can be used to request the next page for list of Azure
     operations.
    :vartype next_link: str
    """

    _validation = {
        'next_link': {'readonly': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[ResourceProviderOperationDefinition]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        value: Optional[List["ResourceProviderOperationDefinition"]] = None,
        **kwargs
    ):
        super(ResourceProviderOperationList, self).__init__(**kwargs)
        self.value = value
        self.next_link = None
