from clarabot_nano.common.request.server_general import AdminEditDenyAnonymousRequest
from clarabot_nano.server.general.handler.admin.config_update.base import AbstractAdminConfigUpdateServerHandler


class EditDenyAnonymousHandler(AbstractAdminConfigUpdateServerHandler):
    HANDLER_KEY = AdminEditDenyAnonymousRequest.TYPE_KEY

    def _create_config_update_request(self) -> dict:
        return {
            "_handler_key": "deny_anonymous",
            "deny_anonymous": self.payload.get(AdminEditDenyAnonymousRequest.VALUE),
        }

    def _log_message(self) -> str:
        return f"Update deny-anonymous policy to {self.payload.get(AdminEditDenyAnonymousRequest.VALUE)}"
