"""cellpointapi.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper
from cellpointapi.models.breadcrumb import Breadcrumb
from cellpointapi.models.completion_redirect import (
    CompletionRedirect,
)
from cellpointapi.models.informational_price_section import (
    InformationalPriceSection,
)
from cellpointapi.models.taxes_and_fees_breakdown_page import (
    TaxesAndFeesBreakdownPage,
)


class HppData(object):
    """Implementation of the 'HppData' model.

    HPP data for the order.

    Attributes:
        page_type (PageType): Type of page to use for the Hosted Payment Page.
        completion_redirect (CompletionRedirect): The model property of type
            CompletionRedirect.
        callback_url (str): Url that should receive callback api calls.
        taxes_and_fees_breakdown_page (TaxesAndFeesBreakdownPage): Information to
            fill the taxes and fees breakdown page.
        breadcrumbs (List[Breadcrumb]): Breadcrumbs to show at the top of the page,
            indicating the buyer's progress through the entire booking and payment
            process.
        on_site_payments_required (List[InformationalPriceSection]): Payments that
            will be required when the buyer is physically present on-site.  These are
            not processed as part of this order and all information passed in this
            node is purely for display purposes.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "completion_redirect": "completionRedirect",
        "taxes_and_fees_breakdown_page": "taxesAndFeesBreakdownPage",
        "breadcrumbs": "breadcrumbs",
        "page_type": "pageType",
        "callback_url": "callbackUrl",
        "on_site_payments_required": "onSitePaymentsRequired",
    }

    _optionals = [
        "page_type",
        "callback_url",
        "on_site_payments_required",
    ]

    def __init__(
        self,
        completion_redirect=None,
        taxes_and_fees_breakdown_page=None,
        breadcrumbs=None,
        page_type="FULL_PAGE_REDIRECT",
        callback_url=APIHelper.SKIP,
        on_site_payments_required=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a HppData instance."""
        # Initialize members of the class
        self.page_type = page_type
        self.completion_redirect = completion_redirect
        if callback_url is not APIHelper.SKIP:
            self.callback_url = callback_url
        self.taxes_and_fees_breakdown_page = taxes_and_fees_breakdown_page
        self.breadcrumbs = breadcrumbs
        if on_site_payments_required is not APIHelper.SKIP:
            self.on_site_payments_required = on_site_payments_required

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        completion_redirect =\
            CompletionRedirect.from_dictionary(
                dictionary.get("completionRedirect"))\
                if dictionary.get("completionRedirect") else None
        taxes_and_fees_breakdown_page =\
            TaxesAndFeesBreakdownPage.from_dictionary(
                dictionary.get("taxesAndFeesBreakdownPage"))\
                if dictionary.get("taxesAndFeesBreakdownPage") else None
        breadcrumbs = None
        if dictionary.get("breadcrumbs") is not None:
            breadcrumbs = [
                Breadcrumb.from_dictionary(x)
                    for x in dictionary.get("breadcrumbs")
            ]
        page_type =\
            dictionary.get("pageType")\
            if dictionary.get("pageType")\
                else "FULL_PAGE_REDIRECT"
        callback_url =\
            dictionary.get("callbackUrl")\
            if dictionary.get("callbackUrl")\
                else APIHelper.SKIP
        on_site_payments_required = None
        if dictionary.get("onSitePaymentsRequired") is not None:
            on_site_payments_required = [
                InformationalPriceSection.from_dictionary(x)
                    for x in dictionary.get("onSitePaymentsRequired")
            ]
        else:
            on_site_payments_required = APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(completion_redirect,
                   taxes_and_fees_breakdown_page,
                   breadcrumbs,
                   page_type,
                   callback_url,
                   on_site_payments_required,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _page_type=(
            self.page_type
            if hasattr(self, "page_type")
            else None
        )
        _completion_redirect=self.completion_redirect
        _callback_url=(
            self.callback_url
            if hasattr(self, "callback_url")
            else None
        )
        _taxes_and_fees_breakdown_page=self.taxes_and_fees_breakdown_page
        _breadcrumbs=self.breadcrumbs
        _on_site_payments_required=(
            self.on_site_payments_required
            if hasattr(self, "on_site_payments_required")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"page_type={_page_type!r}, "
            f"completion_redirect={_completion_redirect!r}, "
            f"callback_url={_callback_url!r}, "
            f"taxes_and_fees_breakdown_page={_taxes_and_fees_breakdown_page!r}, "
            f"breadcrumbs={_breadcrumbs!r}, "
            f"on_site_payments_required={_on_site_payments_required!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _page_type=(
            self.page_type
            if hasattr(self, "page_type")
            else None
        )
        _completion_redirect=self.completion_redirect
        _callback_url=(
            self.callback_url
            if hasattr(self, "callback_url")
            else None
        )
        _taxes_and_fees_breakdown_page=self.taxes_and_fees_breakdown_page
        _breadcrumbs=self.breadcrumbs
        _on_site_payments_required=(
            self.on_site_payments_required
            if hasattr(self, "on_site_payments_required")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"page_type={_page_type!s}, "
            f"completion_redirect={_completion_redirect!s}, "
            f"callback_url={_callback_url!s}, "
            f"taxes_and_fees_breakdown_page={_taxes_and_fees_breakdown_page!s}, "
            f"breadcrumbs={_breadcrumbs!s}, "
            f"on_site_payments_required={_on_site_payments_required!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
