# coding: utf-8

"""
    Patch API V1

    The core API used to integrate with Patch's service  # noqa: E501

    The version of the OpenAPI document: v1
    Contact: developers@usepatch.com
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from patch_api.configuration import Configuration


class Preference(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 = {"id": "str", "allocation_percentage": "int", "project": "Project"}

    attribute_map = {
        "id": "id",
        "allocation_percentage": "allocation_percentage",
        "project": "project",
    }

    def __init__(
        self,
        id=None,
        allocation_percentage=None,
        project=None,
        local_vars_configuration=None,
    ):  # noqa: E501
        """Preference - 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._id = None
        self._allocation_percentage = None
        self._project = None
        self.discriminator = None

        self.id = id
        self.allocation_percentage = allocation_percentage
        self.project = project

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

        A unique uid for the record. UIDs will be prepended by pre_prod or pre_test depending on the mode it was created in.  # noqa: E501

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

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

        A unique uid for the record. UIDs will be prepended by pre_prod or pre_test depending on the mode it was created in.  # noqa: E501

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

        self._id = id

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

        Percentage of total purchased offsets that should go to a project. Default is 100%.  # noqa: E501

        :return: The allocation_percentage of this Preference.  # noqa: E501
        :rtype: int
        """
        return self._allocation_percentage

    @allocation_percentage.setter
    def allocation_percentage(self, allocation_percentage):
        """Sets the allocation_percentage of this Preference.

        Percentage of total purchased offsets that should go to a project. Default is 100%.  # noqa: E501

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

        self._allocation_percentage = allocation_percentage

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

        An object returning the Project record this Preference is associated with. See the [Project section](/?id=projects) for the full schema.  # noqa: E501

        :return: The project of this Preference.  # noqa: E501
        :rtype: Project
        """
        return self._project

    @project.setter
    def project(self, project):
        """Sets the project of this Preference.

        An object returning the Project record this Preference is associated with. See the [Project section](/?id=projects) for the full schema.  # noqa: E501

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

        self._project = project

    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, Preference):
            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, Preference):
            return True

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