# coding: utf-8

"""
    Agilicus API

    Agilicus API endpoints  # noqa: E501

    The version of the OpenAPI document: 2021.04.01
    Contact: dev@agilicus.com
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from agilicus_api.configuration import Configuration


class ApplicationService(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    openapi_types = {
        'created': 'datetime',
        'id': 'str',
        'name': 'str',
        'org_id': 'str',
        'hostname': 'str',
        'ipv4_addresses': 'list[str]',
        'name_resolution': 'str',
        'port': 'int',
        'protocol': 'str',
        'assignments': 'list[ApplicationServiceAssignment]',
        'updated': 'datetime',
        'service_type': 'str',
        'service_protocol_type': 'str',
        'tls_enabled': 'bool',
        'tls_verify': 'bool',
        'connector_id': 'str',
        'connection_uri': 'str'
    }

    attribute_map = {
        'created': 'created',
        'id': 'id',
        'name': 'name',
        'org_id': 'org_id',
        'hostname': 'hostname',
        'ipv4_addresses': 'ipv4_addresses',
        'name_resolution': 'name_resolution',
        'port': 'port',
        'protocol': 'protocol',
        'assignments': 'assignments',
        'updated': 'updated',
        'service_type': 'service_type',
        'service_protocol_type': 'service_protocol_type',
        'tls_enabled': 'tls_enabled',
        'tls_verify': 'tls_verify',
        'connector_id': 'connector_id',
        'connection_uri': 'connection_uri'
    }

    def __init__(self, created=None, id=None, name=None, org_id=None, hostname=None, ipv4_addresses=None, name_resolution='static', port=None, protocol='tcp', assignments=None, updated=None, service_type=None, service_protocol_type=None, tls_enabled=None, tls_verify=None, connector_id=None, connection_uri=None, local_vars_configuration=None):  # noqa: E501
        """ApplicationService - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._created = None
        self._id = None
        self._name = None
        self._org_id = None
        self._hostname = None
        self._ipv4_addresses = None
        self._name_resolution = None
        self._port = None
        self._protocol = None
        self._assignments = None
        self._updated = None
        self._service_type = None
        self._service_protocol_type = None
        self._tls_enabled = None
        self._tls_verify = None
        self._connector_id = None
        self._connection_uri = None
        self.discriminator = None

        if created is not None:
            self.created = created
        if id is not None:
            self.id = id
        self.name = name
        self.org_id = org_id
        if hostname is not None:
            self.hostname = hostname
        if ipv4_addresses is not None:
            self.ipv4_addresses = ipv4_addresses
        if name_resolution is not None:
            self.name_resolution = name_resolution
        if port is not None:
            self.port = port
        if protocol is not None:
            self.protocol = protocol
        if assignments is not None:
            self.assignments = assignments
        if updated is not None:
            self.updated = updated
        if service_type is not None:
            self.service_type = service_type
        if service_protocol_type is not None:
            self.service_protocol_type = service_protocol_type
        if tls_enabled is not None:
            self.tls_enabled = tls_enabled
        if tls_verify is not None:
            self.tls_verify = tls_verify
        if connector_id is not None:
            self.connector_id = connector_id
        if connection_uri is not None:
            self.connection_uri = connection_uri

    @property
    def created(self):
        """Gets the created of this ApplicationService.  # noqa: E501

        Creation time  # noqa: E501

        :return: The created of this ApplicationService.  # noqa: E501
        :rtype: datetime
        """
        return self._created

    @created.setter
    def created(self, created):
        """Sets the created of this ApplicationService.

        Creation time  # noqa: E501

        :param created: The created of this ApplicationService.  # noqa: E501
        :type: datetime
        """

        self._created = created

    @property
    def id(self):
        """Gets the id of this ApplicationService.  # noqa: E501

        Unique identifier  # noqa: E501

        :return: The id of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """Sets the id of this ApplicationService.

        Unique identifier  # noqa: E501

        :param id: The id of this ApplicationService.  # noqa: E501
        :type: str
        """

        self._id = id

    @property
    def name(self):
        """Gets the name of this ApplicationService.  # noqa: E501

        The name of the service. Services will be selected and assigned using this. This value must be unique within an organisation.   # noqa: E501

        :return: The name of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this ApplicationService.

        The name of the service. Services will be selected and assigned using this. This value must be unique within an organisation.   # noqa: E501

        :param name: The name of this ApplicationService.  # noqa: E501
        :type: str
        """
        if self.local_vars_configuration.client_side_validation and name is None:  # noqa: E501
            raise ValueError("Invalid value for `name`, must not be `None`")  # noqa: E501

        self._name = name

    @property
    def org_id(self):
        """Gets the org_id of this ApplicationService.  # noqa: E501

        The organisation which owns this service.  # noqa: E501

        :return: The org_id of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._org_id

    @org_id.setter
    def org_id(self, org_id):
        """Sets the org_id of this ApplicationService.

        The organisation which owns this service.  # noqa: E501

        :param org_id: The org_id of this ApplicationService.  # noqa: E501
        :type: str
        """
        if self.local_vars_configuration.client_side_validation and org_id is None:  # noqa: E501
            raise ValueError("Invalid value for `org_id`, must not be `None`")  # noqa: E501

        self._org_id = org_id

    @property
    def hostname(self):
        """Gets the hostname of this ApplicationService.  # noqa: E501

        The hostname of the service. Your applications will refer to this service using its hostname. This can also be the IP Address of the service. If the address is an IPv4 Address it will add the IP to the ipv4_addresses field and set the name_resolution to static   # noqa: E501

        :return: The hostname of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._hostname

    @hostname.setter
    def hostname(self, hostname):
        """Sets the hostname of this ApplicationService.

        The hostname of the service. Your applications will refer to this service using its hostname. This can also be the IP Address of the service. If the address is an IPv4 Address it will add the IP to the ipv4_addresses field and set the name_resolution to static   # noqa: E501

        :param hostname: The hostname of this ApplicationService.  # noqa: E501
        :type: str
        """

        self._hostname = hostname

    @property
    def ipv4_addresses(self):
        """Gets the ipv4_addresses of this ApplicationService.  # noqa: E501

        The IPv4 addresses of `hostname` within the data center.  # noqa: E501

        :return: The ipv4_addresses of this ApplicationService.  # noqa: E501
        :rtype: list[str]
        """
        return self._ipv4_addresses

    @ipv4_addresses.setter
    def ipv4_addresses(self, ipv4_addresses):
        """Sets the ipv4_addresses of this ApplicationService.

        The IPv4 addresses of `hostname` within the data center.  # noqa: E501

        :param ipv4_addresses: The ipv4_addresses of this ApplicationService.  # noqa: E501
        :type: list[str]
        """

        self._ipv4_addresses = ipv4_addresses

    @property
    def name_resolution(self):
        """Gets the name_resolution of this ApplicationService.  # noqa: E501

        How to resolve the hostname of the service. If static, then ipv4_address will be used. Otherwise, if dns the Organisation's dns services will be queried.   # noqa: E501

        :return: The name_resolution of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._name_resolution

    @name_resolution.setter
    def name_resolution(self, name_resolution):
        """Sets the name_resolution of this ApplicationService.

        How to resolve the hostname of the service. If static, then ipv4_address will be used. Otherwise, if dns the Organisation's dns services will be queried.   # noqa: E501

        :param name_resolution: The name_resolution of this ApplicationService.  # noqa: E501
        :type: str
        """
        allowed_values = ["static", "dns"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and name_resolution not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `name_resolution` ({0}), must be one of {1}"  # noqa: E501
                .format(name_resolution, allowed_values)
            )

        self._name_resolution = name_resolution

    @property
    def port(self):
        """Gets the port of this ApplicationService.  # noqa: E501

        The transport-layer port on which to access the service. exclusiveMinimum: 0 exclusiveMaximum: 65536   # noqa: E501

        :return: The port of this ApplicationService.  # noqa: E501
        :rtype: int
        """
        return self._port

    @port.setter
    def port(self, port):
        """Sets the port of this ApplicationService.

        The transport-layer port on which to access the service. exclusiveMinimum: 0 exclusiveMaximum: 65536   # noqa: E501

        :param port: The port of this ApplicationService.  # noqa: E501
        :type: int
        """

        self._port = port

    @property
    def protocol(self):
        """Gets the protocol of this ApplicationService.  # noqa: E501

        The transport-layer protocol over which to communicate with the service.   # noqa: E501

        :return: The protocol of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._protocol

    @protocol.setter
    def protocol(self, protocol):
        """Sets the protocol of this ApplicationService.

        The transport-layer protocol over which to communicate with the service.   # noqa: E501

        :param protocol: The protocol of this ApplicationService.  # noqa: E501
        :type: str
        """
        allowed_values = ["tcp"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and protocol not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `protocol` ({0}), must be one of {1}"  # noqa: E501
                .format(protocol, allowed_values)
            )

        self._protocol = protocol

    @property
    def assignments(self):
        """Gets the assignments of this ApplicationService.  # noqa: E501

        The Application Environments which have access to this ApplicationService. Manipulate this list to add or remove access to the ApplicationService.   # noqa: E501

        :return: The assignments of this ApplicationService.  # noqa: E501
        :rtype: list[ApplicationServiceAssignment]
        """
        return self._assignments

    @assignments.setter
    def assignments(self, assignments):
        """Sets the assignments of this ApplicationService.

        The Application Environments which have access to this ApplicationService. Manipulate this list to add or remove access to the ApplicationService.   # noqa: E501

        :param assignments: The assignments of this ApplicationService.  # noqa: E501
        :type: list[ApplicationServiceAssignment]
        """

        self._assignments = assignments

    @property
    def updated(self):
        """Gets the updated of this ApplicationService.  # noqa: E501

        Update time  # noqa: E501

        :return: The updated of this ApplicationService.  # noqa: E501
        :rtype: datetime
        """
        return self._updated

    @updated.setter
    def updated(self, updated):
        """Sets the updated of this ApplicationService.

        Update time  # noqa: E501

        :param updated: The updated of this ApplicationService.  # noqa: E501
        :type: datetime
        """

        self._updated = updated

    @property
    def service_type(self):
        """Gets the service_type of this ApplicationService.  # noqa: E501

        The type of application service. This refers to how the application connects to the service  # noqa: E501

        :return: The service_type of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._service_type

    @service_type.setter
    def service_type(self, service_type):
        """Sets the service_type of this ApplicationService.

        The type of application service. This refers to how the application connects to the service  # noqa: E501

        :param service_type: The service_type of this ApplicationService.  # noqa: E501
        :type: str
        """
        allowed_values = ["vpn", "internet", "agent", "ipsec"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and service_type not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `service_type` ({0}), must be one of {1}"  # noqa: E501
                .format(service_type, allowed_values)
            )

        self._service_type = service_type

    @property
    def service_protocol_type(self):
        """Gets the service_protocol_type of this ApplicationService.  # noqa: E501

        The protocol carried by this service. This indicates to the Agilicus infrastructure how to interpret the data being transmitted to the service. Different protocols have different subclasses of an ApplicationService used to configure that protocol's details. This field may take on the following values:   - ip: Any upper layer protocols are transparent to the Agilicus infrastructure.     Agilicus does not participate in the protocol.   - fileshare: The service is a fileshare. Agilicus will participate in the file sharing     protocol in order to expose the fileshare to the Internet.   # noqa: E501

        :return: The service_protocol_type of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._service_protocol_type

    @service_protocol_type.setter
    def service_protocol_type(self, service_protocol_type):
        """Sets the service_protocol_type of this ApplicationService.

        The protocol carried by this service. This indicates to the Agilicus infrastructure how to interpret the data being transmitted to the service. Different protocols have different subclasses of an ApplicationService used to configure that protocol's details. This field may take on the following values:   - ip: Any upper layer protocols are transparent to the Agilicus infrastructure.     Agilicus does not participate in the protocol.   - fileshare: The service is a fileshare. Agilicus will participate in the file sharing     protocol in order to expose the fileshare to the Internet.   # noqa: E501

        :param service_protocol_type: The service_protocol_type of this ApplicationService.  # noqa: E501
        :type: str
        """
        allowed_values = ["ip", "fileshare"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and service_protocol_type not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `service_protocol_type` ({0}), must be one of {1}"  # noqa: E501
                .format(service_protocol_type, allowed_values)
            )

        self._service_protocol_type = service_protocol_type

    @property
    def tls_enabled(self):
        """Gets the tls_enabled of this ApplicationService.  # noqa: E501

        Whether Transport Layer Security (TLS) is enabled for this ip service running over tcp. This field has no meaning for non-ip services, or services using a transport protocol other than tcp.   # noqa: E501

        :return: The tls_enabled of this ApplicationService.  # noqa: E501
        :rtype: bool
        """
        return self._tls_enabled

    @tls_enabled.setter
    def tls_enabled(self, tls_enabled):
        """Sets the tls_enabled of this ApplicationService.

        Whether Transport Layer Security (TLS) is enabled for this ip service running over tcp. This field has no meaning for non-ip services, or services using a transport protocol other than tcp.   # noqa: E501

        :param tls_enabled: The tls_enabled of this ApplicationService.  # noqa: E501
        :type: bool
        """

        self._tls_enabled = tls_enabled

    @property
    def tls_verify(self):
        """Gets the tls_verify of this ApplicationService.  # noqa: E501

        Whether the certificate presented by the Service is verified by the infrastructure. This can be useful when interacting with a test server which may not have a production certificate signed by a public certificate authority.   # noqa: E501

        :return: The tls_verify of this ApplicationService.  # noqa: E501
        :rtype: bool
        """
        return self._tls_verify

    @tls_verify.setter
    def tls_verify(self, tls_verify):
        """Sets the tls_verify of this ApplicationService.

        Whether the certificate presented by the Service is verified by the infrastructure. This can be useful when interacting with a test server which may not have a production certificate signed by a public certificate authority.   # noqa: E501

        :param tls_verify: The tls_verify of this ApplicationService.  # noqa: E501
        :type: bool
        """

        self._tls_verify = tls_verify

    @property
    def connector_id(self):
        """Gets the connector_id of this ApplicationService.  # noqa: E501

        Unique identifier  # noqa: E501

        :return: The connector_id of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._connector_id

    @connector_id.setter
    def connector_id(self, connector_id):
        """Sets the connector_id of this ApplicationService.

        Unique identifier  # noqa: E501

        :param connector_id: The connector_id of this ApplicationService.  # noqa: E501
        :type: str
        """

        self._connector_id = connector_id

    @property
    def connection_uri(self):
        """Gets the connection_uri of this ApplicationService.  # noqa: E501

        The URI by which this service can be directly accessed. Depending on the type of connector associated with this service, the URI could be public or internal to the Agilicus infrastructure. In both cases, valid credentials proving permission to access this service are necessary to access the service. If this field is empty, then it cannot be accessed directly..   # noqa: E501

        :return: The connection_uri of this ApplicationService.  # noqa: E501
        :rtype: str
        """
        return self._connection_uri

    @connection_uri.setter
    def connection_uri(self, connection_uri):
        """Sets the connection_uri of this ApplicationService.

        The URI by which this service can be directly accessed. Depending on the type of connector associated with this service, the URI could be public or internal to the Agilicus infrastructure. In both cases, valid credentials proving permission to access this service are necessary to access the service. If this field is empty, then it cannot be accessed directly..   # noqa: E501

        :param connection_uri: The connection_uri of this ApplicationService.  # noqa: E501
        :type: str
        """
        if (self.local_vars_configuration.client_side_validation and
                connection_uri is not None and len(connection_uri) > 1024):
            raise ValueError("Invalid value for `connection_uri`, length must be less than or equal to `1024`")  # noqa: E501

        self._connection_uri = connection_uri

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, ApplicationService):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, ApplicationService):
            return True

        return self.to_dict() != other.to_dict()
