"""mindbodypublicapi.

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

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


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

    POST UserToken/Issue request

    Attributes:
        username (str): The staff member’s username.
        password (str): The staff member’s password.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "username": "Username",
        "password": "Password",
    }

    _optionals = [
        "username",
        "password",
    ]

    def __init__(
        self,
        username=APIHelper.SKIP,
        password=APIHelper.SKIP):
        """Initialize a IssueRequest instance."""
        # Initialize members of the class
        if username is not APIHelper.SKIP:
            self.username = username
        if password is not APIHelper.SKIP:
            self.password = password

    @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
        username =\
            dictionary.get("Username")\
            if dictionary.get("Username")\
                else APIHelper.SKIP
        password =\
            dictionary.get("Password")\
            if dictionary.get("Password")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(username,
                   password)

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

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