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