"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.embedded_12 import (
    Embedded12,
)
from visaacceptancemergedspec.models.links_66 import (
    Links66,
)


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

    Attributes:
        links (Links66): The model property of type Links66.
        offset (int): The offset parameter supplied in the request.
        limit (int): The limit parameter supplied in the request.
        count (int): The number of Payment Instruments returned in the array.
        total (int): The total number of Payment Instruments associated with the
            Customer or Instrument Identifier.
        embedded (Embedded12): The model property of type Embedded12.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "links": "_links",
        "offset": "offset",
        "limit": "limit",
        "count": "count",
        "total": "total",
        "embedded": "_embedded",
    }

    _optionals = [
        "links",
        "offset",
        "limit",
        "count",
        "total",
        "embedded",
    ]

    def __init__(
        self,
        links=APIHelper.SKIP,
        offset=0,
        limit=20,
        count=APIHelper.SKIP,
        total=APIHelper.SKIP,
        embedded=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PaymentInstrumentList instance."""
        # Initialize members of the class
        if links is not APIHelper.SKIP:
            self.links = links
        self.offset = offset
        self.limit = limit
        if count is not APIHelper.SKIP:
            self.count = count
        if total is not APIHelper.SKIP:
            self.total = total
        if embedded is not APIHelper.SKIP:
            self.embedded = embedded

        # 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
        links =\
            Links66.from_dictionary(
                dictionary.get("_links"))\
                if "_links" in dictionary.keys()\
                else APIHelper.SKIP
        offset =\
            dictionary.get("offset")\
            if dictionary.get("offset")\
                else 0
        limit =\
            dictionary.get("limit")\
            if dictionary.get("limit")\
                else 20
        count =\
            dictionary.get("count")\
            if dictionary.get("count")\
                else APIHelper.SKIP
        total =\
            dictionary.get("total")\
            if dictionary.get("total")\
                else APIHelper.SKIP
        embedded =\
            Embedded12.from_dictionary(
                dictionary.get("_embedded"))\
                if "_embedded" in dictionary.keys()\
                else 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(links,
                   offset,
                   limit,
                   count,
                   total,
                   embedded,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _offset=(
            self.offset
            if hasattr(self, "offset")
            else None
        )
        _limit=(
            self.limit
            if hasattr(self, "limit")
            else None
        )
        _count=(
            self.count
            if hasattr(self, "count")
            else None
        )
        _total=(
            self.total
            if hasattr(self, "total")
            else None
        )
        _embedded=(
            self.embedded
            if hasattr(self, "embedded")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"links={_links!r}, "
            f"offset={_offset!r}, "
            f"limit={_limit!r}, "
            f"count={_count!r}, "
            f"total={_total!r}, "
            f"embedded={_embedded!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _offset=(
            self.offset
            if hasattr(self, "offset")
            else None
        )
        _limit=(
            self.limit
            if hasattr(self, "limit")
            else None
        )
        _count=(
            self.count
            if hasattr(self, "count")
            else None
        )
        _total=(
            self.total
            if hasattr(self, "total")
            else None
        )
        _embedded=(
            self.embedded
            if hasattr(self, "embedded")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"links={_links!s}, "
            f"offset={_offset!s}, "
            f"limit={_limit!s}, "
            f"count={_count!s}, "
            f"total={_total!s}, "
            f"embedded={_embedded!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
