# -*- coding: utf-8 -*-
#
# This class was auto-generated from the API references found at
# https://support.direct.ingenico.com/documentation/api/reference/
#
from ingenico.direct.sdk.data_object import DataObject
from ingenico.direct.sdk.domain.address import Address
from ingenico.direct.sdk.domain.company_information import CompanyInformation
from ingenico.direct.sdk.domain.personal_information_token import PersonalInformationToken


class CustomerToken(DataObject):

    __billing_address = None
    __company_information = None
    __personal_information = None

    @property
    def billing_address(self) -> Address:
        """
        | Object containing billing address details

        Type: :class:`ingenico.direct.sdk.domain.address.Address`
        """
        return self.__billing_address

    @billing_address.setter
    def billing_address(self, value: Address):
        self.__billing_address = value

    @property
    def company_information(self) -> CompanyInformation:
        """
        | Object containing company information

        Type: :class:`ingenico.direct.sdk.domain.company_information.CompanyInformation`
        """
        return self.__company_information

    @company_information.setter
    def company_information(self, value: CompanyInformation):
        self.__company_information = value

    @property
    def personal_information(self) -> PersonalInformationToken:
        """
        Type: :class:`ingenico.direct.sdk.domain.personal_information_token.PersonalInformationToken`
        """
        return self.__personal_information

    @personal_information.setter
    def personal_information(self, value: PersonalInformationToken):
        self.__personal_information = value

    def to_dictionary(self):
        dictionary = super(CustomerToken, self).to_dictionary()
        if self.billing_address is not None:
            dictionary['billingAddress'] = self.billing_address.to_dictionary()
        if self.company_information is not None:
            dictionary['companyInformation'] = self.company_information.to_dictionary()
        if self.personal_information is not None:
            dictionary['personalInformation'] = self.personal_information.to_dictionary()
        return dictionary

    def from_dictionary(self, dictionary):
        super(CustomerToken, self).from_dictionary(dictionary)
        if 'billingAddress' in dictionary:
            if not isinstance(dictionary['billingAddress'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['billingAddress']))
            value = Address()
            self.billing_address = value.from_dictionary(dictionary['billingAddress'])
        if 'companyInformation' in dictionary:
            if not isinstance(dictionary['companyInformation'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['companyInformation']))
            value = CompanyInformation()
            self.company_information = value.from_dictionary(dictionary['companyInformation'])
        if 'personalInformation' in dictionary:
            if not isinstance(dictionary['personalInformation'], dict):
                raise TypeError('value \'{}\' is not a dictionary'.format(dictionary['personalInformation']))
            value = PersonalInformationToken()
            self.personal_information = value.from_dictionary(dictionary['personalInformation'])
        return self

[((70, 20, 70, 29), 'ingenico.direct.sdk.domain.address.Address', 'Address', ({}, {}), '()', False, 'from ingenico.direct.sdk.domain.address import Address\n'), ((75, 20, 75, 40), 'ingenico.direct.sdk.domain.company_information.CompanyInformation', 'CompanyInformation', ({}, {}), '()', False, 'from ingenico.direct.sdk.domain.company_information import CompanyInformation\n'), ((80, 20, 80, 46), 'ingenico.direct.sdk.domain.personal_information_token.PersonalInformationToken', 'PersonalInformationToken', ({}, {}), '()', False, 'from ingenico.direct.sdk.domain.personal_information_token import PersonalInformationToken\n')]