In my understanding :
- もちろん = of course
- はい = yes
- うん = yes
When is each of them more appropriate to use, or is it basically just preference? Are other options more casual than the other options?
もちろん is used when you want to say "of course". If you need it to be formal => もちろんです。
はい is formal to say yes and other stuff.
うん is like はい but casual, not to use to people you protocolly respect.