Virtual Switch with 3 states in OpenHAB 3

Using a Number as a multi way switch is fine, common practice.

When what is clicked?

You’ve used your sitemap to make your Number look like a multi way switch for other UIs. Does that work, have you tried in BasicUI?

But MainUI takes no notice of sitemaps. You’d need to fiddle with Item metadata to fool MainUI to treat it like a switch.
See

For the rule, you would generally trigger from received command if it is supposed to respond to UI clicks.