"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


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

    Attributes:
        capture_sequence_number (int): Capture number when requesting multiple
            partial captures for one authorization. Used along with
            `totalCaptureCount` to track which capture is being processed.  For
            example, the second of five captures would be passed to Visa Acceptance
            as:   - `captureSequenceNumber_ = 2`, and   - `totalCaptureCount = 5`
        total_capture_count (int): Total number of captures when requesting multiple
            partial captures for one payment. Used along with `captureSequenceNumber`
            field to track which capture is being processed.  For example, the second
            of five captures would be passed to Visa Acceptance as:   -
            `captureSequenceNumber = 2`, and   - `totalCaptureCount = 5`
        is_final (str): Indicates whether to release the authorization hold on the
            remaining funds.   Possible Values: - `true` - `false`
        notes (str): An informational note about this settlement. Appears in both the
            payer's transaction history and the emails that the payer receives.
        reconciliation_id_alternate (str): Used by Nike merchant to send 12 digit
            order number
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "capture_sequence_number": "captureSequenceNumber",
        "total_capture_count": "totalCaptureCount",
        "is_final": "isFinal",
        "notes": "notes",
        "reconciliation_id_alternate": "reconciliationIdAlternate",
    }

    _optionals = [
        "capture_sequence_number",
        "total_capture_count",
        "is_final",
        "notes",
        "reconciliation_id_alternate",
    ]

    def __init__(
        self,
        capture_sequence_number=APIHelper.SKIP,
        total_capture_count=APIHelper.SKIP,
        is_final=APIHelper.SKIP,
        notes=APIHelper.SKIP,
        reconciliation_id_alternate=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a CaptureOptions2 instance."""
        # Initialize members of the class
        if capture_sequence_number is not APIHelper.SKIP:
            self.capture_sequence_number = capture_sequence_number
        if total_capture_count is not APIHelper.SKIP:
            self.total_capture_count = total_capture_count
        if is_final is not APIHelper.SKIP:
            self.is_final = is_final
        if notes is not APIHelper.SKIP:
            self.notes = notes
        if reconciliation_id_alternate is not APIHelper.SKIP:
            self.reconciliation_id_alternate = reconciliation_id_alternate

        # 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
        capture_sequence_number =\
            dictionary.get("captureSequenceNumber")\
            if dictionary.get("captureSequenceNumber")\
                else APIHelper.SKIP
        total_capture_count =\
            dictionary.get("totalCaptureCount")\
            if dictionary.get("totalCaptureCount")\
                else APIHelper.SKIP
        is_final =\
            dictionary.get("isFinal")\
            if dictionary.get("isFinal")\
                else APIHelper.SKIP
        notes =\
            dictionary.get("notes")\
            if dictionary.get("notes")\
                else APIHelper.SKIP
        reconciliation_id_alternate =\
            dictionary.get("reconciliationIdAlternate")\
            if dictionary.get("reconciliationIdAlternate")\
                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(capture_sequence_number,
                   total_capture_count,
                   is_final,
                   notes,
                   reconciliation_id_alternate,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _capture_sequence_number=(
            self.capture_sequence_number
            if hasattr(self, "capture_sequence_number")
            else None
        )
        _total_capture_count=(
            self.total_capture_count
            if hasattr(self, "total_capture_count")
            else None
        )
        _is_final=(
            self.is_final
            if hasattr(self, "is_final")
            else None
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _reconciliation_id_alternate=(
            self.reconciliation_id_alternate
            if hasattr(self, "reconciliation_id_alternate")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"capture_sequence_number={_capture_sequence_number!r}, "
            f"total_capture_count={_total_capture_count!r}, "
            f"is_final={_is_final!r}, "
            f"notes={_notes!r}, "
            f"reconciliation_id_alternate={_reconciliation_id_alternate!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _capture_sequence_number=(
            self.capture_sequence_number
            if hasattr(self, "capture_sequence_number")
            else None
        )
        _total_capture_count=(
            self.total_capture_count
            if hasattr(self, "total_capture_count")
            else None
        )
        _is_final=(
            self.is_final
            if hasattr(self, "is_final")
            else None
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _reconciliation_id_alternate=(
            self.reconciliation_id_alternate
            if hasattr(self, "reconciliation_id_alternate")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"capture_sequence_number={_capture_sequence_number!s}, "
            f"total_capture_count={_total_capture_count!s}, "
            f"is_final={_is_final!s}, "
            f"notes={_notes!s}, "
            f"reconciliation_id_alternate={_reconciliation_id_alternate!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
