"""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.links_13 import (
    Links13,
)
from visaacceptancemergedspec.models.transaction_batch import (
    TransactionBatch,
)


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

    Attributes:
        transaction_batches (List[TransactionBatch]): The model property of type
            List[TransactionBatch].
        links (Links13): The model property of type Links13.
        submit_time_utc (str): Time of request in UTC. Format: `YYYY-MM-DDThh:mm:ssZ`
            **Example** `2016-08-11T22:47:57Z` equals August 11, 2016, at 22:47:57
            (10:47:57 p.m.). The `T` separates the date and the time. The `Z`
            indicates UTC.  Returned by Visa Acceptance for all services.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "transaction_batches": "transactionBatches",
        "links": "_links",
        "submit_time_utc": "submitTimeUtc",
    }

    _optionals = [
        "transaction_batches",
        "links",
        "submit_time_utc",
    ]

    def __init__(
        self,
        transaction_batches=APIHelper.SKIP,
        links=APIHelper.SKIP,
        submit_time_utc=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PtsV1TransactionBatchesGet200Response instance."""
        # Initialize members of the class
        if transaction_batches is not APIHelper.SKIP:
            self.transaction_batches = transaction_batches
        if links is not APIHelper.SKIP:
            self.links = links
        if submit_time_utc is not APIHelper.SKIP:
            self.submit_time_utc = submit_time_utc

        # 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
        transaction_batches = None
        if dictionary.get("transactionBatches") is not None:
            transaction_batches = [
                TransactionBatch.from_dictionary(x)
                    for x in dictionary.get("transactionBatches")
            ]
        else:
            transaction_batches = APIHelper.SKIP
        links =\
            Links13.from_dictionary(
                dictionary.get("_links"))\
                if "_links" in dictionary.keys()\
                else APIHelper.SKIP
        submit_time_utc =\
            dictionary.get("submitTimeUtc")\
            if dictionary.get("submitTimeUtc")\
                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(transaction_batches,
                   links,
                   submit_time_utc,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _transaction_batches=(
            self.transaction_batches
            if hasattr(self, "transaction_batches")
            else None
        )
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _submit_time_utc=(
            self.submit_time_utc
            if hasattr(self, "submit_time_utc")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"transaction_batches={_transaction_batches!r}, "
            f"links={_links!r}, "
            f"submit_time_utc={_submit_time_utc!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _transaction_batches=(
            self.transaction_batches
            if hasattr(self, "transaction_batches")
            else None
        )
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _submit_time_utc=(
            self.submit_time_utc
            if hasattr(self, "submit_time_utc")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"transaction_batches={_transaction_batches!s}, "
            f"links={_links!s}, "
            f"submit_time_utc={_submit_time_utc!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
