# coding: utf-8

"""
    DeviceServer

    DeviceServer API  # noqa: E501

    The version of the OpenAPI document: 1.1.2
    Contact: david@3adesign.co.uk
    Generated by: https://openapi-generator.tech
"""


try:
    from inspect import getfullargspec
except ImportError:
    from inspect import getargspec as getfullargspec
import pprint
import re  # noqa: F401
import six

from DeviceServer.configuration import Configuration


class DbPortState(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 = {
        'port_state_id': 'str',
        'port_id': 'str',
        'label': 'str',
        'index': 'int'
    }

    attribute_map = {
        'port_state_id': 'port_state_id',
        'port_id': 'port_id',
        'label': 'label',
        'index': 'index'
    }

    def __init__(self, port_state_id=None, port_id=None, label=None, index=None, local_vars_configuration=None):  # noqa: E501
        """DbPortState - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration.get_default_copy()
        self.local_vars_configuration = local_vars_configuration

        self._port_state_id = None
        self._port_id = None
        self._label = None
        self._index = None
        self.discriminator = None

        self.port_state_id = port_state_id
        self.port_id = port_id
        self.label = label
        self.index = index

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


        :return: The port_state_id of this DbPortState.  # noqa: E501
        :rtype: str
        """
        return self._port_state_id

    @port_state_id.setter
    def port_state_id(self, port_state_id):
        """Sets the port_state_id of this DbPortState.


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

        self._port_state_id = port_state_id

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


        :return: The port_id of this DbPortState.  # noqa: E501
        :rtype: str
        """
        return self._port_id

    @port_id.setter
    def port_id(self, port_id):
        """Sets the port_id of this DbPortState.


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

        self._port_id = port_id

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


        :return: The label of this DbPortState.  # noqa: E501
        :rtype: str
        """
        return self._label

    @label.setter
    def label(self, label):
        """Sets the label of this DbPortState.


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

        self._label = label

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


        :return: The index of this DbPortState.  # noqa: E501
        :rtype: int
        """
        return self._index

    @index.setter
    def index(self, index):
        """Sets the index of this DbPortState.


        :param index: The index of this DbPortState.  # noqa: E501
        :type index: int
        """
        if self.local_vars_configuration.client_side_validation and index is None:  # noqa: E501
            raise ValueError("Invalid value for `index`, must not be `None`")  # noqa: E501
        if (self.local_vars_configuration.client_side_validation and
                index is not None and index > 100):  # noqa: E501
            raise ValueError("Invalid value for `index`, must be a value less than or equal to `100`")  # noqa: E501
        if (self.local_vars_configuration.client_side_validation and
                index is not None and index < 1):  # noqa: E501
            raise ValueError("Invalid value for `index`, must be a value greater than or equal to `1`")  # noqa: E501

        self._index = index

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

        def convert(x):
            if hasattr(x, "to_dict"):
                args = getfullargspec(x.to_dict).args
                if len(args) == 1:
                    return x.to_dict()
                else:
                    return x.to_dict(serialize)
            else:
                return x

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            attr = self.attribute_map.get(attr, attr) if serialize else attr
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: convert(x),
                    value
                ))
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], convert(item[1])),
                    value.items()
                ))
            else:
                result[attr] = convert(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, DbPortState):
            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, DbPortState):
            return True

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