| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Ui5\Capabilities; |
| 4: | |
| 5: | use LaravelUi5\Core\Contracts\ConfigurableInterface; |
| 6: | use LaravelUi5\Core\Contracts\ParameterizableInterface; |
| 7: | |
| 8: | /** |
| 9: | * Contract for UI5 Action Handlers. |
| 10: | * |
| 11: | * An ActionHandler encapsulates the runtime logic for a UI5 Action. |
| 12: | * Unlike {@see DataProviderInterface} implementations, ActionHandlers |
| 13: | * are explicitly designed to perform *state-changing operations* such as |
| 14: | * - updating or deleting records |
| 15: | * - triggering workflows or notifications |
| 16: | * - executing domain-specific commands |
| 17: | * |
| 18: | * Responsibilities: |
| 19: | * - Implement a single `execute()` method containing the action logic. |
| 20: | * - Always return an **array** describing the outcome (machine- and |
| 21: | * human-readable), e.g.: |
| 22: | * ```php |
| 23: | * ['status' => 'success', 'message' => 'Mailbox cleared'] |
| 24: | * ``` |
| 25: | * - May implement {@see ConfigurableInterface} to consume settings or |
| 26: | * feature flags that influence runtime behavior. |
| 27: | * |
| 28: | * Notes: |
| 29: | * - Input expectations are declared via {@see ParameterizableInterface}, |
| 30: | * - ActionHandlers must always return a structured result, even if |
| 31: | * no payload is strictly required (e.g., a simple status + message). |
| 32: | * - Dependencies (repositories, services) should be injected via |
| 33: | * constructor dependency injection for testability and clarity. |
| 34: | */ |
| 35: | interface ActionHandlerInterface extends ExecutableInterface, ParameterizableInterface |
| 36: | { |
| 37: | } |
| 38: |