"""mindbodypublicapi.

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

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


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

    Attributes:
        permission_group_name (str): The name of the permission group.
        ip_restricted (bool): When `true`, the staff member’s permissions are
            restricted to specific IP addresses.<br />  When `false`, the staff
            member’s permissions are not restricted to specific IP addresses.
        allowed_permissions (List[AllowedPermissionEnum]): A list of the permissions
            allowed to the staff member. See [Permission
            Values](https://developers.mindbodyonline.com/PublicDocumentation/V6#eperm
            ission-values) for descriptions of the possible permissions.
        denied_permissions (List[DeniedPermissionEnum]): A list of the permissions
            that the staff member is not allowed to exercise. See [Permission
            Values](https://developers.mindbodyonline.com/PublicDocumentation/V6#eperm
            ission-values) for descriptions of the possible permissions.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "permission_group_name": "PermissionGroupName",
        "ip_restricted": "IpRestricted",
        "allowed_permissions": "AllowedPermissions",
        "denied_permissions": "DeniedPermissions",
    }

    _optionals = [
        "permission_group_name",
        "ip_restricted",
        "allowed_permissions",
        "denied_permissions",
    ]

    def __init__(
        self,
        permission_group_name=APIHelper.SKIP,
        ip_restricted=APIHelper.SKIP,
        allowed_permissions=APIHelper.SKIP,
        denied_permissions=APIHelper.SKIP):
        """Initialize a StaffPermissionGroup instance."""
        # Initialize members of the class
        if permission_group_name is not APIHelper.SKIP:
            self.permission_group_name = permission_group_name
        if ip_restricted is not APIHelper.SKIP:
            self.ip_restricted = ip_restricted
        if allowed_permissions is not APIHelper.SKIP:
            self.allowed_permissions = allowed_permissions
        if denied_permissions is not APIHelper.SKIP:
            self.denied_permissions = denied_permissions

    @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
        permission_group_name =\
            dictionary.get("PermissionGroupName")\
            if dictionary.get("PermissionGroupName")\
                else APIHelper.SKIP
        ip_restricted =\
            dictionary.get("IpRestricted")\
            if "IpRestricted" in dictionary.keys()\
                else APIHelper.SKIP
        allowed_permissions =\
            dictionary.get("AllowedPermissions")\
            if dictionary.get("AllowedPermissions")\
                else APIHelper.SKIP
        denied_permissions =\
            dictionary.get("DeniedPermissions")\
            if dictionary.get("DeniedPermissions")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(permission_group_name,
                   ip_restricted,
                   allowed_permissions,
                   denied_permissions)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _permission_group_name=(
            self.permission_group_name
            if hasattr(self, "permission_group_name")
            else None
        )
        _ip_restricted=(
            self.ip_restricted
            if hasattr(self, "ip_restricted")
            else None
        )
        _allowed_permissions=(
            self.allowed_permissions
            if hasattr(self, "allowed_permissions")
            else None
        )
        _denied_permissions=(
            self.denied_permissions
            if hasattr(self, "denied_permissions")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"permission_group_name={_permission_group_name!r}, "
            f"ip_restricted={_ip_restricted!r}, "
            f"allowed_permissions={_allowed_permissions!r}, "
            f"denied_permissions={_denied_permissions!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _permission_group_name=(
            self.permission_group_name
            if hasattr(self, "permission_group_name")
            else None
        )
        _ip_restricted=(
            self.ip_restricted
            if hasattr(self, "ip_restricted")
            else None
        )
        _allowed_permissions=(
            self.allowed_permissions
            if hasattr(self, "allowed_permissions")
            else None
        )
        _denied_permissions=(
            self.denied_permissions
            if hasattr(self, "denied_permissions")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"permission_group_name={_permission_group_name!s}, "
            f"ip_restricted={_ip_restricted!s}, "
            f"allowed_permissions={_allowed_permissions!s}, "
            f"denied_permissions={_denied_permissions!s}, "
            f")"
        )
