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


class EditBackupIntervalHandler(AbstractAdminConfigUpdateServerHandler):
    HANDLER_KEY = AdminEditBackupIntervalRequest.TYPE_KEY

    def _create_config_update_request(self) -> dict:
        return {
            "_handler_key": "backup_interval",
            "backup_interval": self.payload.get(AdminEditBackupIntervalRequest.INTERVAL),
        }

    def _log_message(self) -> str:
        return f"Update backup-interval to {self.payload.get(AdminEditBackupIntervalRequest.INTERVAL)}"
