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


class UpdateRequireExplicitPeerTrust(AbstractRemoteConfigUpdateHandler):
    HANDLER_KEY = "require_explicit_peer_trust"

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

    def _describe_change(self, old_config: dict, new_config: dict, data: dict) -> str:
        return f"Nano require-explicit-peer-trust policy set to {new_config.get('require_explicit_peer_trust')!r}"
