Is it possible to change refresh-mode of a daemon from a hook?

The behavior I want to achieve is to restart the running service of a snap by default only if a config is set to false.

E.g. snap set endure = false snap refresh service restarts snap set endure = true snap refresh service does NOT restart

I think this should be possible to check the config value in the post-refresh hook and restart depending on the value but I wanted to check if you could change the refresh-mode value that is set in snapcraft.yml from a hook