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


class UpdateBackupInterval(AbstractRemoteConfigUpdateHandler):
    HANDLER_KEY = "backup_interval"

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

    def _describe_change(self, old_config: dict, new_config: dict, data: dict) -> str:
        return f"Nano backup-interval set to {new_config.get('backup_interval')!r}"
