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


class EditNameHandler(AbstractAdminConfigUpdateServerHandler):
    HANDLER_KEY = AdminEditNameRequest.TYPE_KEY

    def _create_config_update_request(self) -> dict:
        return {"_handler_key": "name", "name": self.payload.get(AdminEditNameRequest.NAME)}

    def _log_message(self) -> str:
        return f"Nano name update to {self.payload.get(AdminEditNameRequest.NAME)}"
