| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Ui5\Contracts; |
| 4: | |
| 5: | /** |
| 6: | * A Ui5Module represents the root-level container for all UI5-related artifacts |
| 7: | * provided by a feature package or domain module in the LaravelUi5 ecosystem. |
| 8: | * |
| 9: | * A module can contain either a UI5 application or a library, but not both. |
| 10: | * Only applications can provide subordinate artifacts such as cards, actions, |
| 11: | * reports, KPIs, and tiles. |
| 12: | * |
| 13: | * Responsibilities: |
| 14: | * - Expose the main artifact (App or Library) via type-specific getters |
| 15: | * - Declare all subordinate artifacts (if applicable) |
| 16: | * - Provide artifact metadata via Ui5ArtifactInterface |
| 17: | * |
| 18: | * System rules: |
| 19: | * - A module MUST provide either an app or a library (exclusive) |
| 20: | * - A library MUST NOT define subordinate artifacts |
| 21: | * - Every artifact must have a globally unique namespace |
| 22: | */ |
| 23: | interface Ui5ModuleInterface extends SluggableInterface |
| 24: | { |
| 25: | /** |
| 26: | * Returns true if this module provides a UI5 application. |
| 27: | * |
| 28: | * @return bool |
| 29: | */ |
| 30: | public function hasApp(): bool; |
| 31: | |
| 32: | /** |
| 33: | * Returns the application artifact, if present. |
| 34: | * |
| 35: | * @return Ui5AppInterface|null |
| 36: | */ |
| 37: | public function getApp(): ?Ui5AppInterface; |
| 38: | |
| 39: | /** |
| 40: | * Returns true if this module provides a UI5 library. |
| 41: | * |
| 42: | * @return bool |
| 43: | */ |
| 44: | public function hasLibrary(): bool; |
| 45: | |
| 46: | /** |
| 47: | * Returns the library artifact, if present. |
| 48: | * |
| 49: | * @return Ui5LibraryInterface|null |
| 50: | */ |
| 51: | public function getLibrary(): ?Ui5LibraryInterface; |
| 52: | |
| 53: | /** |
| 54: | * Returns the root artifact of the module — either the application or the library, |
| 55: | * depending on the module type. |
| 56: | * |
| 57: | * This method allows consumers to access the primary artifact in a generic way, |
| 58: | * without checking whether the module is app- or library-based. |
| 59: | * |
| 60: | * @return Ui5ArtifactInterface The root artifact (App or Library) |
| 61: | */ |
| 62: | public function getArtifactRoot(): Ui5ArtifactInterface; |
| 63: | |
| 64: | /** |
| 65: | * Returns an array of all cards provided by this module. |
| 66: | * Only available if this module provides an app. |
| 67: | * |
| 68: | * @return Ui5CardInterface[] |
| 69: | */ |
| 70: | public function getCards(): array; |
| 71: | |
| 72: | /** |
| 73: | * Returns an array of all KPIs provided by this module. |
| 74: | * |
| 75: | * @return Ui5KpiInterface[] |
| 76: | */ |
| 77: | public function getKpis(): array; |
| 78: | |
| 79: | /** |
| 80: | * Returns an array of all tiles for launchpad or navigation purposes. |
| 81: | * |
| 82: | * @return Ui5TileInterface[] |
| 83: | */ |
| 84: | public function getTiles(): array; |
| 85: | |
| 86: | /** |
| 87: | * Returns an array of all actions (API endpoints) provided by this module. |
| 88: | * |
| 89: | * @return Ui5ActionInterface[] |
| 90: | */ |
| 91: | public function getActions(): array; |
| 92: | |
| 93: | /** |
| 94: | * Returns an array of all resources (API) provided by this module. |
| 95: | * |
| 96: | * @return Ui5ResourceInterface[] |
| 97: | */ |
| 98: | public function getResources(): array; |
| 99: | } |
| 100: |