# coding: utf-8

"""
    Trackside Software TeamDB API v2.0

    This API enables you to access TeamDB data  # noqa: E501

    OpenAPI spec version: 2.0
    Contact: support@trackside.fr
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six

from teamdbapi.configuration import Configuration


class Run(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_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.
    """
    swagger_types = {
        'id': 'str',
        'short_name': 'str',
        'number': 'int',
        'order': 'str',
        'session_id': 'str',
        'run_date': 'datetime',
        'run_status': 'str',
        'is_valid': 'bool',
        'last_update_date_utc': 'datetime',
        'last_update_user': 'str',
        'revision': 'int',
        'tire_set_id': 'str',
        'changed_part': 'str',
        'lap_count': 'int',
        'distance': 'float',
        'distance_real': 'float',
        'used_in_run_plan': 'bool'
    }

    attribute_map = {
        'id': 'Id',
        'short_name': 'ShortName',
        'number': 'Number',
        'order': 'Order',
        'session_id': 'SessionId',
        'run_date': 'RunDate',
        'run_status': 'RunStatus',
        'is_valid': 'IsValid',
        'last_update_date_utc': 'LastUpdateDateUtc',
        'last_update_user': 'LastUpdateUser',
        'revision': 'Revision',
        'tire_set_id': 'TireSetId',
        'changed_part': 'ChangedPart',
        'lap_count': 'LapCount',
        'distance': 'Distance',
        'distance_real': 'DistanceReal',
        'used_in_run_plan': 'UsedInRunPlan'
    }

    def __init__(self, id=None, short_name=None, number=None, order=None, session_id=None, run_date=None, run_status=None, is_valid=True, last_update_date_utc=None, last_update_user=None, revision=None, tire_set_id=None, changed_part=None, lap_count=None, distance=None, distance_real=None, used_in_run_plan=True, _configuration=None):  # noqa: E501
        """Run - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._id = None
        self._short_name = None
        self._number = None
        self._order = None
        self._session_id = None
        self._run_date = None
        self._run_status = None
        self._is_valid = None
        self._last_update_date_utc = None
        self._last_update_user = None
        self._revision = None
        self._tire_set_id = None
        self._changed_part = None
        self._lap_count = None
        self._distance = None
        self._distance_real = None
        self._used_in_run_plan = None
        self.discriminator = None

        self.id = id
        self.short_name = short_name
        self.number = number
        self.order = order
        self.session_id = session_id
        self.run_date = run_date
        if run_status is not None:
            self.run_status = run_status
        if is_valid is not None:
            self.is_valid = is_valid
        if last_update_date_utc is not None:
            self.last_update_date_utc = last_update_date_utc
        if last_update_user is not None:
            self.last_update_user = last_update_user
        if revision is not None:
            self.revision = revision
        if tire_set_id is not None:
            self.tire_set_id = tire_set_id
        if changed_part is not None:
            self.changed_part = changed_part
        if lap_count is not None:
            self.lap_count = lap_count
        if distance is not None:
            self.distance = distance
        if distance_real is not None:
            self.distance_real = distance_real
        if used_in_run_plan is not None:
            self.used_in_run_plan = used_in_run_plan

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

        The run id.  # noqa: E501

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

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

        The run id.  # noqa: E501

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

        self._id = id

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

        The run short name.  # noqa: E501

        :return: The short_name of this Run.  # noqa: E501
        :rtype: str
        """
        return self._short_name

    @short_name.setter
    def short_name(self, short_name):
        """Sets the short_name of this Run.

        The run short name.  # noqa: E501

        :param short_name: The short_name of this Run.  # noqa: E501
        :type: str
        """
        if self._configuration.client_side_validation and short_name is None:
            raise ValueError("Invalid value for `short_name`, must not be `None`")  # noqa: E501
        if (self._configuration.client_side_validation and
                short_name is not None and len(short_name) < 1):
            raise ValueError("Invalid value for `short_name`, length must be greater than or equal to `1`")  # noqa: E501

        self._short_name = short_name

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

        The run number.  # noqa: E501

        :return: The number of this Run.  # noqa: E501
        :rtype: int
        """
        return self._number

    @number.setter
    def number(self, number):
        """Sets the number of this Run.

        The run number.  # noqa: E501

        :param number: The number of this Run.  # noqa: E501
        :type: int
        """
        if self._configuration.client_side_validation and number is None:
            raise ValueError("Invalid value for `number`, must not be `None`")  # noqa: E501

        self._number = number

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

        The run order.  # noqa: E501

        :return: The order of this Run.  # noqa: E501
        :rtype: str
        """
        return self._order

    @order.setter
    def order(self, order):
        """Sets the order of this Run.

        The run order.  # noqa: E501

        :param order: The order of this Run.  # noqa: E501
        :type: str
        """
        if self._configuration.client_side_validation and order is None:
            raise ValueError("Invalid value for `order`, must not be `None`")  # noqa: E501
        if (self._configuration.client_side_validation and
                order is not None and len(order) < 1):
            raise ValueError("Invalid value for `order`, length must be greater than or equal to `1`")  # noqa: E501

        self._order = order

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

        The session unique id to which the run is linked.  # noqa: E501

        :return: The session_id of this Run.  # noqa: E501
        :rtype: str
        """
        return self._session_id

    @session_id.setter
    def session_id(self, session_id):
        """Sets the session_id of this Run.

        The session unique id to which the run is linked.  # noqa: E501

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

        self._session_id = session_id

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

        The run date.  The date must be an UTC date time. Here is an example : 2018-06-05T12:36:34.168Z  # noqa: E501

        :return: The run_date of this Run.  # noqa: E501
        :rtype: datetime
        """
        return self._run_date

    @run_date.setter
    def run_date(self, run_date):
        """Sets the run_date of this Run.

        The run date.  The date must be an UTC date time. Here is an example : 2018-06-05T12:36:34.168Z  # noqa: E501

        :param run_date: The run_date of this Run.  # noqa: E501
        :type: datetime
        """
        if self._configuration.client_side_validation and run_date is None:
            raise ValueError("Invalid value for `run_date`, must not be `None`")  # noqa: E501

        self._run_date = run_date

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

        The run status.  # noqa: E501

        :return: The run_status of this Run.  # noqa: E501
        :rtype: str
        """
        return self._run_status

    @run_status.setter
    def run_status(self, run_status):
        """Sets the run_status of this Run.

        The run status.  # noqa: E501

        :param run_status: The run_status of this Run.  # noqa: E501
        :type: str
        """
        allowed_values = ["Normal", "Service", "Virtual"]  # noqa: E501
        if (self._configuration.client_side_validation and
                run_status not in allowed_values):
            raise ValueError(
                "Invalid value for `run_status` ({0}), must be one of {1}"  # noqa: E501
                .format(run_status, allowed_values)
            )

        self._run_status = run_status

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

        The run \"valid\" status.  # noqa: E501

        :return: The is_valid of this Run.  # noqa: E501
        :rtype: bool
        """
        return self._is_valid

    @is_valid.setter
    def is_valid(self, is_valid):
        """Sets the is_valid of this Run.

        The run \"valid\" status.  # noqa: E501

        :param is_valid: The is_valid of this Run.  # noqa: E501
        :type: bool
        """

        self._is_valid = is_valid

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

        The last utc date time when the properties of this object have been updated.  This field will be automatically updated from the server side each time you update the object.  # noqa: E501

        :return: The last_update_date_utc of this Run.  # noqa: E501
        :rtype: datetime
        """
        return self._last_update_date_utc

    @last_update_date_utc.setter
    def last_update_date_utc(self, last_update_date_utc):
        """Sets the last_update_date_utc of this Run.

        The last utc date time when the properties of this object have been updated.  This field will be automatically updated from the server side each time you update the object.  # noqa: E501

        :param last_update_date_utc: The last_update_date_utc of this Run.  # noqa: E501
        :type: datetime
        """

        self._last_update_date_utc = last_update_date_utc

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

        The name of the last user having updated this object.  This field will be automatically updated from the server side each time you update the object.  # noqa: E501

        :return: The last_update_user of this Run.  # noqa: E501
        :rtype: str
        """
        return self._last_update_user

    @last_update_user.setter
    def last_update_user(self, last_update_user):
        """Sets the last_update_user of this Run.

        The name of the last user having updated this object.  This field will be automatically updated from the server side each time you update the object.  # noqa: E501

        :param last_update_user: The last_update_user of this Run.  # noqa: E501
        :type: str
        """

        self._last_update_user = last_update_user

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

        The revision number of the object.  # noqa: E501

        :return: The revision of this Run.  # noqa: E501
        :rtype: int
        """
        return self._revision

    @revision.setter
    def revision(self, revision):
        """Sets the revision of this Run.

        The revision number of the object.  # noqa: E501

        :param revision: The revision of this Run.  # noqa: E501
        :type: int
        """

        self._revision = revision

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

        The tyre set id linked to the run  # noqa: E501

        :return: The tire_set_id of this Run.  # noqa: E501
        :rtype: str
        """
        return self._tire_set_id

    @tire_set_id.setter
    def tire_set_id(self, tire_set_id):
        """Sets the tire_set_id of this Run.

        The tyre set id linked to the run  # noqa: E501

        :param tire_set_id: The tire_set_id of this Run.  # noqa: E501
        :type: str
        """

        self._tire_set_id = tire_set_id

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

        Car Part changed  # noqa: E501

        :return: The changed_part of this Run.  # noqa: E501
        :rtype: str
        """
        return self._changed_part

    @changed_part.setter
    def changed_part(self, changed_part):
        """Sets the changed_part of this Run.

        Car Part changed  # noqa: E501

        :param changed_part: The changed_part of this Run.  # noqa: E501
        :type: str
        """

        self._changed_part = changed_part

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

        Lap count in the run  # noqa: E501

        :return: The lap_count of this Run.  # noqa: E501
        :rtype: int
        """
        return self._lap_count

    @lap_count.setter
    def lap_count(self, lap_count):
        """Sets the lap_count of this Run.

        Lap count in the run  # noqa: E501

        :param lap_count: The lap_count of this Run.  # noqa: E501
        :type: int
        """

        self._lap_count = lap_count

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

        Distance performed on the run  # noqa: E501

        :return: The distance of this Run.  # noqa: E501
        :rtype: float
        """
        return self._distance

    @distance.setter
    def distance(self, distance):
        """Sets the distance of this Run.

        Distance performed on the run  # noqa: E501

        :param distance: The distance of this Run.  # noqa: E501
        :type: float
        """

        self._distance = distance

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

        distance real performed during the run  # noqa: E501

        :return: The distance_real of this Run.  # noqa: E501
        :rtype: float
        """
        return self._distance_real

    @distance_real.setter
    def distance_real(self, distance_real):
        """Sets the distance_real of this Run.

        distance real performed during the run  # noqa: E501

        :param distance_real: The distance_real of this Run.  # noqa: E501
        :type: float
        """

        self._distance_real = distance_real

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

        Specify whether the run can be used by a run plan  # noqa: E501

        :return: The used_in_run_plan of this Run.  # noqa: E501
        :rtype: bool
        """
        return self._used_in_run_plan

    @used_in_run_plan.setter
    def used_in_run_plan(self, used_in_run_plan):
        """Sets the used_in_run_plan of this Run.

        Specify whether the run can be used by a run plan  # noqa: E501

        :param used_in_run_plan: The used_in_run_plan of this Run.  # noqa: E501
        :type: bool
        """

        self._used_in_run_plan = used_in_run_plan

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

        for attr, _ in six.iteritems(self.swagger_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
        if issubclass(Run, dict):
            for key, value in self.items():
                result[key] = 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, Run):
            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, Run):
            return True

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