"""mindbodypublicapi.

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

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


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

    Attributes:
        available_dates (List[datetime]): A list of dates where scheduled appointment
            availability was found after applying request filters.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "available_dates": "AvailableDates",
    }

    _optionals = [
        "available_dates",
    ]

    def __init__(
        self,
        available_dates=APIHelper.SKIP):
        """Initialize a GetAvailableDatesResponse instance."""
        # Initialize members of the class
        if available_dates is not None and available_dates is not APIHelper.SKIP:
            self.available_dates = APIHelper.apply_datetime_converter(
                available_dates, APIHelper.RFC3339DateTime)

    @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
        available_dates = None
        if dictionary.get("AvailableDates") is not None:
            available_dates = list()
            for x in dictionary.get("AvailableDates"):
                available_dates.append(APIHelper.RFC3339DateTime.from_value(x).datetime)
        else:
            available_dates = APIHelper.SKIP

        # Return an object of this model
        return cls(available_dates)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _available_dates=(
            self.available_dates
            if hasattr(self, "available_dates")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"available_dates={_available_dates!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _available_dates=(
            self.available_dates
            if hasattr(self, "available_dates")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"available_dates={_available_dates!s}, "
            f")"
        )
