| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Ui5\Contracts; |
| 4: | |
| 5: | /** |
| 6: | * Generic contract for any executable UI5 component. |
| 7: | * |
| 8: | * This interface unifies the runtime contract for classes that can be |
| 9: | * *executed* by the framework, such as: |
| 10: | * |
| 11: | * - {@see DataProviderInterface}: read-only providers that return |
| 12: | * structured data (e.g., for Cards, Resources, Reports). |
| 13: | * - {@see ActionHandlerInterface}: state-changing handlers that perform |
| 14: | * mutations or trigger workflows (e.g. "toggle-lock", "approve-invoice"). |
| 15: | * |
| 16: | * Having this shared contract allows controllers and orchestration |
| 17: | * services to interact with both providers and handlers in a uniform way, |
| 18: | * while still preserving semantic separation at the type level. |
| 19: | * |
| 20: | * ### Design notes |
| 21: | * - The return type is: |
| 22: | * - *array<string,mixed>* for structured data results. |
| 23: | * - Cross-cutting concerns (parameter resolution, configuration injection) |
| 24: | * are handled externally via {@see ParameterizableInterface} and |
| 25: | * {@see ConfigurableInterface}. |
| 26: | * - Dependencies (repositories, services) should be provided via |
| 27: | * constructor DI; do not inject via the `execute()` method. |
| 28: | */ |
| 29: | interface ExecutableInterface |
| 30: | { |
| 31: | /** |
| 32: | * Execute the component logic and return the result. |
| 33: | * |
| 34: | * @return array<string,mixed> Structured data. |
| 35: | */ |
| 36: | public function execute(): array; |
| 37: | } |
| 38: |