from clarabot_nano.core.config.update.base import AbstractRemoteConfigUpdateHandler


class UpdateDenyAnonymous(AbstractRemoteConfigUpdateHandler):
    HANDLER_KEY = "deny_anonymous"

    def _execute(self, data: dict):
        self._c["deny_anonymous"] = data["deny_anonymous"]

    def _describe_change(self, old_config: dict, new_config: dict, data: dict) -> str:
        return f"Nano deny-anonymous policy set to {new_config.get('deny_anonymous')!r}"
