# High-level explanation

I have an object with some methods:

 public class Foo
 {
 public void Bar() { }
 public void Baz() { }
 }

These methods cannot be executed unconditionally, there is some validation to be done. I'd also like to expose these conditions to a client (user) in some way.

I could do this with a collection of enum values:

 public enum FooAction
 {
 Bar,
 Baz
 }
 
 public class Foo
 {
 public void Bar() { if (GetAvailableActions().Contains(FooAction.Bar)) }
 public void Baz() { if (GetAvailableActions().Contains(FooAction.Baz)) }
 
 public IEnumerable<FooAction> GetAvailableActions() { }
 }

I could also do this with boolean functions:

 public class Foo
 {
 public void Bar() { if (CanBar()) }
 public void Baz() { if (CanBaz()) }
 
 public bool CanBar() { }
 public bool CanBaz() { }
 }

I've tried to come up with a reason to favour one over the other, but I can only think of a possible performance benefit depending on how much input data these methods would have in common. And likely said performance benefit would be negligible.

Are there any real-world problems that could occur with one solution and not with the other? Or does the whole thing boil down to personal preference?

# Concrete example

 public class Patient
 {
 public IEnumerable<Prescription> Prescriptions { get; set; }
 }
 
 public class Prescription
 {
 public IEnumerable<Administration> Administrations { get; set; }
 }
 
 public class Administration
 {
 public void Administer(string foo, int bar) { }
 
 public void Prepare(string baz, bool bat) { }
 }

* `Prepare(...)` may only be called if `Prepare(...)` has not yet been called before
* `Administer(...)` may not be called if the `Prescription` has an unadministered `Administration` scheduled at an earlier point in time.
* `Administer(...)` may not be called if the `Administration` depends on the weight of the `Patient`, and the weight of the `Patient` is unknown.

These rules can be very simple and very complex. In the client, a user can click an 'Administer' button, fill in a form and click a 'Confirm' button. I don't want to let the user click the 'Administer' button to open the form, if these pre-conditions indicate that the action will fail regardless of data entered into the form.

---

I've added the [tag:domain-driven-design] and [tag:cqrs] tags because it's in the context of a DDD/CQRS architecture, but I'm not sure if that matters for this problem.