"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper


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

    Attributes:
        client_id (str): The ID of the client.
        client_contract_id (int): The unique ID of the sale of the contract.
        suspension_type (str): ex. Illness, Injury, Vacation. (Note this can be
            customized by each studio).  If provided, then Duration, DurationUnit,
            and SuspensionFee (if applicable) are automatically applied. Restrict
            Days are not supported.
        suspension_start (datetime): The contract suspension start date.  Default:
            *today’s date*
        duration (int): The number of (DurationUnit) the suspension lasts.
        duration_unit (int): The unit applied to Duration.
        open_ended (bool): When `true`, indicates that suspension is open ended.
            Also, when `true`, then Duration and DurationUnit are ignored.  Default:
            *false*
        suspension_notes (str): The comments for suspending a contract.
        suspension_fee (float): An optional charge that clients who wish to pause a
            contract for a set period of time can be charged.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": "ClientId",
        "client_contract_id": "ClientContractId",
        "suspension_type": "SuspensionType",
        "suspension_start": "SuspensionStart",
        "duration": "Duration",
        "duration_unit": "DurationUnit",
        "open_ended": "OpenEnded",
        "suspension_notes": "SuspensionNotes",
        "suspension_fee": "SuspensionFee",
    }

    _optionals = [
        "suspension_type",
        "suspension_start",
        "duration",
        "duration_unit",
        "open_ended",
        "suspension_notes",
        "suspension_fee",
    ]

    def __init__(
        self,
        client_id=None,
        client_contract_id=None,
        suspension_type=APIHelper.SKIP,
        suspension_start=APIHelper.SKIP,
        duration=APIHelper.SKIP,
        duration_unit=APIHelper.SKIP,
        open_ended=APIHelper.SKIP,
        suspension_notes=APIHelper.SKIP,
        suspension_fee=APIHelper.SKIP):
        """Initialize a SuspendContractRequest instance."""
        # Initialize members of the class
        self.client_id = client_id
        self.client_contract_id = client_contract_id
        if suspension_type is not APIHelper.SKIP:
            self.suspension_type = suspension_type
        if suspension_start is not APIHelper.SKIP:
            self.suspension_start =\
                 APIHelper.apply_datetime_converter(
                suspension_start, APIHelper.RFC3339DateTime)\
                 if suspension_start else None
        if duration is not APIHelper.SKIP:
            self.duration = duration
        if duration_unit is not APIHelper.SKIP:
            self.duration_unit = duration_unit
        if open_ended is not APIHelper.SKIP:
            self.open_ended = open_ended
        if suspension_notes is not APIHelper.SKIP:
            self.suspension_notes = suspension_notes
        if suspension_fee is not APIHelper.SKIP:
            self.suspension_fee = suspension_fee

    @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
        client_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else None
        client_contract_id =\
            dictionary.get("ClientContractId")\
            if dictionary.get("ClientContractId")\
                else None
        suspension_type =\
            dictionary.get("SuspensionType")\
            if dictionary.get("SuspensionType")\
                else APIHelper.SKIP
        suspension_start = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("SuspensionStart")).datetime\
            if dictionary.get("SuspensionStart") else APIHelper.SKIP
        duration =\
            dictionary.get("Duration")\
            if dictionary.get("Duration")\
                else APIHelper.SKIP
        duration_unit =\
            dictionary.get("DurationUnit")\
            if dictionary.get("DurationUnit")\
                else APIHelper.SKIP
        open_ended =\
            dictionary.get("OpenEnded")\
            if "OpenEnded" in dictionary.keys()\
                else APIHelper.SKIP
        suspension_notes =\
            dictionary.get("SuspensionNotes")\
            if dictionary.get("SuspensionNotes")\
                else APIHelper.SKIP
        suspension_fee =\
            dictionary.get("SuspensionFee")\
            if dictionary.get("SuspensionFee")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client_id,
                   client_contract_id,
                   suspension_type,
                   suspension_start,
                   duration,
                   duration_unit,
                   open_ended,
                   suspension_notes,
                   suspension_fee)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client_id=self.client_id
        _client_contract_id=self.client_contract_id
        _suspension_type=(
            self.suspension_type
            if hasattr(self, "suspension_type")
            else None
        )
        _suspension_start=(
            self.suspension_start
            if hasattr(self, "suspension_start")
            else None
        )
        _duration=(
            self.duration
            if hasattr(self, "duration")
            else None
        )
        _duration_unit=(
            self.duration_unit
            if hasattr(self, "duration_unit")
            else None
        )
        _open_ended=(
            self.open_ended
            if hasattr(self, "open_ended")
            else None
        )
        _suspension_notes=(
            self.suspension_notes
            if hasattr(self, "suspension_notes")
            else None
        )
        _suspension_fee=(
            self.suspension_fee
            if hasattr(self, "suspension_fee")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!r}, "
            f"client_contract_id={_client_contract_id!r}, "
            f"suspension_type={_suspension_type!r}, "
            f"suspension_start={_suspension_start!r}, "
            f"duration={_duration!r}, "
            f"duration_unit={_duration_unit!r}, "
            f"open_ended={_open_ended!r}, "
            f"suspension_notes={_suspension_notes!r}, "
            f"suspension_fee={_suspension_fee!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client_id=self.client_id
        _client_contract_id=self.client_contract_id
        _suspension_type=(
            self.suspension_type
            if hasattr(self, "suspension_type")
            else None
        )
        _suspension_start=(
            self.suspension_start
            if hasattr(self, "suspension_start")
            else None
        )
        _duration=(
            self.duration
            if hasattr(self, "duration")
            else None
        )
        _duration_unit=(
            self.duration_unit
            if hasattr(self, "duration_unit")
            else None
        )
        _open_ended=(
            self.open_ended
            if hasattr(self, "open_ended")
            else None
        )
        _suspension_notes=(
            self.suspension_notes
            if hasattr(self, "suspension_notes")
            else None
        )
        _suspension_fee=(
            self.suspension_fee
            if hasattr(self, "suspension_fee")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!s}, "
            f"client_contract_id={_client_contract_id!s}, "
            f"suspension_type={_suspension_type!s}, "
            f"suspension_start={_suspension_start!s}, "
            f"duration={_duration!s}, "
            f"duration_unit={_duration_unit!s}, "
            f"open_ended={_open_ended!s}, "
            f"suspension_notes={_suspension_notes!s}, "
            f"suspension_fee={_suspension_fee!s}, "
            f")"
        )
