from clarabot_nano_common.common.error import log_escape_str

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


class DeleteDriveHandler(AbstractAdminConfigUpdateServerHandler):
    HANDLER_KEY = AdminDeleteDriveRequest.TYPE_KEY

    def _create_config_update_request(self) -> dict:
        return {"_handler_key": "drive:delete", "path": self.payload.get(AdminDeleteDriveRequest.PATH)}

    def _log_message(self) -> str:
        return f"Delete drive at {log_escape_str(self.payload.get(AdminDeleteDriveRequest.PATH))}"
