# coding: utf-8

"""
    CardPay REST API

    Welcome to the CardPay REST API. The CardPay API uses HTTP verbs and a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) resources endpoint structure (see more info about REST). Request and response payloads are formatted as JSON. Merchant uses API to create payments, refunds, payouts or recurrings, check or update transaction status and get information about created transactions. In API authentication process based on [OAuth 2.0](https://oauth.net/2/) standard. For recent changes see changelog section.  # noqa: E501

    OpenAPI spec version: 3.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six


class BillingAddress(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 = {
        "addr_line_1": "str",
        "addr_line_2": "str",
        "city": "str",
        "country": "str",
        "phone": "str",
        "state": "str",
        "zip": "str",
    }

    attribute_map = {
        "addr_line_1": "addr_line_1",
        "addr_line_2": "addr_line_2",
        "city": "city",
        "country": "country",
        "phone": "phone",
        "state": "state",
        "zip": "zip",
    }

    def __init__(
        self,
        addr_line_1=None,
        addr_line_2=None,
        city=None,
        country=None,
        phone=None,
        state=None,
        zip=None,
    ):  # noqa: E501
        """BillingAddress - a model defined in Swagger"""  # noqa: E501

        self._addr_line_1 = None
        self._addr_line_2 = None
        self._city = None
        self._country = None
        self._phone = None
        self._state = None
        self._zip = None
        self.discriminator = None

        if addr_line_1 is not None:
            self.addr_line_1 = addr_line_1
        if addr_line_2 is not None:
            self.addr_line_2 = addr_line_2
        if city is not None:
            self.city = city
        if country is not None:
            self.country = country
        if phone is not None:
            self.phone = phone
        if state is not None:
            self.state = state
        if zip is not None:
            self.zip = zip

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

        Street address. May include whitespaces, hyphens, apostrophes, commas, quotes, dots, slashes and semicolons  # noqa: E501

        :return: The addr_line_1 of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._addr_line_1

    @addr_line_1.setter
    def addr_line_1(self, addr_line_1):
        """Sets the addr_line_1 of this BillingAddress.

        Street address. May include whitespaces, hyphens, apostrophes, commas, quotes, dots, slashes and semicolons  # noqa: E501

        :param addr_line_1: The addr_line_1 of this BillingAddress.  # noqa: E501
        :type: str
        """

        self._addr_line_1 = addr_line_1

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

        Second line of the street address or equivalent local portion of the Cardholder billing address associated with the card used for this purchase.  # noqa: E501

        :return: The addr_line_2 of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._addr_line_2

    @addr_line_2.setter
    def addr_line_2(self, addr_line_2):
        """Sets the addr_line_2 of this BillingAddress.

        Second line of the street address or equivalent local portion of the Cardholder billing address associated with the card used for this purchase.  # noqa: E501

        :param addr_line_2: The addr_line_2 of this BillingAddress.  # noqa: E501
        :type: str
        """

        self._addr_line_2 = addr_line_2

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

        Delivery city. May include whitespaces, hyphens, apostrophes, commas and dots  # noqa: E501

        :return: The city of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._city

    @city.setter
    def city(self, city):
        """Sets the city of this BillingAddress.

        Delivery city. May include whitespaces, hyphens, apostrophes, commas and dots  # noqa: E501

        :param city: The city of this BillingAddress.  # noqa: E501
        :type: str
        """
        if city is not None and len(city) > 50:
            raise ValueError(
                "Invalid value for `city`, length must be less than or equal to `50`"
            )  # noqa: E501
        if city is not None and len(city) < 0:
            raise ValueError(
                "Invalid value for `city`, length must be greater than or equal to `0`"
            )  # noqa: E501

        self._city = city

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

        [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) code of country: 2 or 3 latin letters or numeric code. Mandatory if 'shipping_address' is presented.  # noqa: E501

        :return: The country of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._country

    @country.setter
    def country(self, country):
        """Sets the country of this BillingAddress.

        [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) code of country: 2 or 3 latin letters or numeric code. Mandatory if 'shipping_address' is presented.  # noqa: E501

        :param country: The country of this BillingAddress.  # noqa: E501
        :type: str
        """

        self._country = country

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

        Valid customer phone number  # noqa: E501

        :return: The phone of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._phone

    @phone.setter
    def phone(self, phone):
        """Sets the phone of this BillingAddress.

        Valid customer phone number  # noqa: E501

        :param phone: The phone of this BillingAddress.  # noqa: E501
        :type: str
        """
        if phone is not None and len(phone) > 20:
            raise ValueError(
                "Invalid value for `phone`, length must be less than or equal to `20`"
            )  # noqa: E501
        if phone is not None and len(phone) < 5:
            raise ValueError(
                "Invalid value for `phone`, length must be greater than or equal to `5`"
            )  # noqa: E501
        if phone is not None and not re.search(r"[-+\\d()wp\\s]+", phone):  # noqa: E501
            raise ValueError(
                r"Invalid value for `phone`, must be a follow pattern or equal to `/[-+\\d()wp\\s]+/`"
            )  # noqa: E501

        self._phone = phone

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

        Delivery state or province. May include whitespaces, hyphens, apostrophes, commas and dots  # noqa: E501

        :return: The state of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._state

    @state.setter
    def state(self, state):
        """Sets the state of this BillingAddress.

        Delivery state or province. May include whitespaces, hyphens, apostrophes, commas and dots  # noqa: E501

        :param state: The state of this BillingAddress.  # noqa: E501
        :type: str
        """
        if state is not None and len(state) > 40:
            raise ValueError(
                "Invalid value for `state`, length must be less than or equal to `40`"
            )  # noqa: E501
        if state is not None and len(state) < 0:
            raise ValueError(
                "Invalid value for `state`, length must be greater than or equal to `0`"
            )  # noqa: E501

        self._state = state

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

        Delivery postal code  # noqa: E501

        :return: The zip of this BillingAddress.  # noqa: E501
        :rtype: str
        """
        return self._zip

    @zip.setter
    def zip(self, zip):
        """Sets the zip of this BillingAddress.

        Delivery postal code  # noqa: E501

        :param zip: The zip of this BillingAddress.  # noqa: E501
        :type: str
        """
        if zip is not None and len(zip) > 12:
            raise ValueError(
                "Invalid value for `zip`, length must be less than or equal to `12`"
            )  # noqa: E501
        if zip is not None and len(zip) < 0:
            raise ValueError(
                "Invalid value for `zip`, length must be greater than or equal to `0`"
            )  # noqa: E501

        self._zip = zip

    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:
                if value is not None:
                    result[attr] = value
        if issubclass(BillingAddress, 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, BillingAddress):
            return False

        return self.__dict__ == other.__dict__

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