"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.api_error import (
    ApiError,
)
from mindbodypublicapi.models.staff import Staff


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

    This is the update avaialability response

    Attributes:
        staff_members (List[Staff]): This is the success list of the trainer
            availability
        errors (List[ApiError]): The model property of type List[ApiError].

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "staff_members": "StaffMembers",
        "errors": "Errors",
    }

    _optionals = [
        "staff_members",
        "errors",
    ]

    def __init__(
        self,
        staff_members=APIHelper.SKIP,
        errors=APIHelper.SKIP):
        """Initialize a UpdateAvailabilityResponse instance."""
        # Initialize members of the class
        if staff_members is not APIHelper.SKIP:
            self.staff_members = staff_members
        if errors is not APIHelper.SKIP:
            self.errors = errors

    @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
        staff_members = None
        if dictionary.get("StaffMembers") is not None:
            staff_members = [
                Staff.from_dictionary(x)
                    for x in dictionary.get("StaffMembers")
            ]
        else:
            staff_members = APIHelper.SKIP
        errors = None
        if dictionary.get("Errors") is not None:
            errors = [
                ApiError.from_dictionary(x)
                    for x in dictionary.get("Errors")
            ]
        else:
            errors = APIHelper.SKIP

        # Return an object of this model
        return cls(staff_members,
                   errors)

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

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