| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Ui5\Contracts; |
| 4: | |
| 5: | use LaravelUi5\Core\Infrastructure\Contracts\Ui5SourceStrategyInterface; |
| 6: | |
| 7: | /** |
| 8: | * A Ui5Module represents the root-level container for all UI5-related artifacts |
| 9: | * provided by a feature package or domain module in the LaravelUi5 ecosystem. |
| 10: | * |
| 11: | * A module can contain either a UI5 application or a UI5 library, but not both. |
| 12: | * Only applications can provide subordinate artifacts such as cards, actions, |
| 13: | * reports, KPIs, and tiles. |
| 14: | * |
| 15: | * Responsibilities: |
| 16: | * - Expose the main artifact (App or Library) via type-specific getters |
| 17: | * - Declare all subordinate artifacts (if applicable) |
| 18: | * - Provide artifact metadata via Ui5ArtifactInterface |
| 19: | * |
| 20: | * System rules: |
| 21: | * - A module MUST provide either an app or a library (exclusive) |
| 22: | * - A library MUST NOT define subordinate artifacts |
| 23: | * - Every artifact must have a globally unique namespace |
| 24: | */ |
| 25: | interface Ui5ModuleInterface |
| 26: | { |
| 27: | /** |
| 28: | * Returns the canonical name of the module. |
| 29: | * |
| 30: | * The module name is a human-readable identifier derived from the module’s |
| 31: | * directory structure (e.g. `Timesheet`, `Partners`, `Finance`) and is used |
| 32: | * for: |
| 33: | * - module introspection, |
| 34: | * - help/documentation resolution, |
| 35: | * - manifest generation, |
| 36: | * - CLI tooling, |
| 37: | * - and internal module mapping. |
| 38: | * |
| 39: | * The name must represent the top-level directory under `/ui5/<Module>/`, |
| 40: | * and is therefore expected to be unique within the installation. |
| 41: | * |
| 42: | * @return string The canonical module name. |
| 43: | */ |
| 44: | public function getName(): string; |
| 45: | |
| 46: | /** |
| 47: | * Returns the Ui5SourceStrategy used to resolve UI5 source artifacts |
| 48: | * for this module. |
| 49: | * |
| 50: | * The source strategy defines *how* and *from where* UI5 resources |
| 51: | * (manifest, preload bundles, i18n files, descriptors) are accessed, |
| 52: | * depending on the module's origin (e.g. workspace-based or packaged). |
| 53: | * |
| 54: | * The returned value is resolved by the Ui5Registry. |
| 55: | * The strategy itself is responsible for: |
| 56: | * - determining the runtime UI5 resource path, |
| 57: | * - and optionally providing introspection capabilities. |
| 58: | * |
| 59: | * Important: |
| 60: | * - This method does NOT perform any filesystem access. |
| 61: | * - It only declares which strategy applies to this module. |
| 62: | * |
| 63: | * @return Ui5SourceStrategyInterface Strategy for resolving Ui5Source artifacts. |
| 64: | */ |
| 65: | public function getSourceStrategy(): Ui5SourceStrategyInterface; |
| 66: | |
| 67: | /** |
| 68: | * Returns true if this module provides a UI5 application. |
| 69: | * |
| 70: | * @return bool |
| 71: | */ |
| 72: | public function hasApp(): bool; |
| 73: | |
| 74: | /** |
| 75: | * Returns the application artifact, if present. |
| 76: | * |
| 77: | * @return Ui5AppInterface|null |
| 78: | */ |
| 79: | public function getApp(): ?Ui5AppInterface; |
| 80: | |
| 81: | /** |
| 82: | * Returns true if this module provides a UI5 library. |
| 83: | * |
| 84: | * @return bool |
| 85: | */ |
| 86: | public function hasLibrary(): bool; |
| 87: | |
| 88: | /** |
| 89: | * Returns the library artifact, if present. |
| 90: | * |
| 91: | * @return Ui5LibraryInterface|null |
| 92: | */ |
| 93: | public function getLibrary(): ?Ui5LibraryInterface; |
| 94: | |
| 95: | /** |
| 96: | * Returns the root artifact of the module — either the application or the library, |
| 97: | * depending on the module type. |
| 98: | * |
| 99: | * This method allows consumers to access the primary artifact in a generic way, |
| 100: | * without checking whether the module is app- or library-based. |
| 101: | * |
| 102: | * @return Ui5AppInterface|Ui5LibraryInterface The root artifact (App or Library) |
| 103: | */ |
| 104: | public function getArtifactRoot(): Ui5AppInterface|Ui5LibraryInterface; |
| 105: | |
| 106: | /** |
| 107: | * Returns an array of all cards provided by this module. |
| 108: | * Only available if this module provides an app. |
| 109: | * |
| 110: | * @return Ui5CardInterface[] |
| 111: | */ |
| 112: | public function getCards(): array; |
| 113: | |
| 114: | /** |
| 115: | * Returns an array of all KPIs provided by this module. |
| 116: | * |
| 117: | * @return Ui5KpiInterface[] |
| 118: | */ |
| 119: | public function getKpis(): array; |
| 120: | |
| 121: | /** |
| 122: | * Returns an array of all tiles for launchpad or navigation purposes. |
| 123: | * |
| 124: | * @return Ui5TileInterface[] |
| 125: | */ |
| 126: | public function getTiles(): array; |
| 127: | |
| 128: | /** |
| 129: | * Returns an array of all actions (API endpoints) provided by this module. |
| 130: | * |
| 131: | * @return Ui5ActionInterface[] |
| 132: | */ |
| 133: | public function getActions(): array; |
| 134: | |
| 135: | /** |
| 136: | * Returns an array of all resources (API) provided by this module. |
| 137: | * |
| 138: | * @return Ui5ResourceInterface[] |
| 139: | */ |
| 140: | public function getResources(): array; |
| 141: | |
| 142: | /** |
| 143: | * Returns an array of all dashboards (API) provided by this module. |
| 144: | * |
| 145: | * This artifact type is not discovered automatically. It must be declared |
| 146: | * under the dedicated configuration key `dashboards` inside your module’s |
| 147: | * `config/ui5.php`. |
| 148: | * |
| 149: | * @return Ui5DashboardInterface[] |
| 150: | */ |
| 151: | public function getDashboards(): array; |
| 152: | |
| 153: | /** |
| 154: | * Returns an array of all resports (API) provided by this module. |
| 155: | * |
| 156: | * This artifact type is not discovered automatically. It must be declared |
| 157: | * under the dedicated configuration key `reports` inside your module’s |
| 158: | * `config/ui5.php`. |
| 159: | * |
| 160: | * @return Ui5ReportInterface[] |
| 161: | */ |
| 162: | public function getReports(): array; |
| 163: | |
| 164: | /** |
| 165: | * Returns an array of all dialogs (API) provided by this module. |
| 166: | * |
| 167: | * This artifact type is not discovered automatically. It must be declared |
| 168: | * under the dedicated configuration key `dialogs` inside your module’s |
| 169: | * `config/ui5.php`. |
| 170: | * |
| 171: | * @return Ui5DialogInterface[] |
| 172: | */ |
| 173: | public function getDialogs(): array; |
| 174: | |
| 175: | /** |
| 176: | * Returns all artifacts belonging to this module (app, library, tiles, cards, |
| 177: | * kpis, actions, resources, dashboards, reports, dialogs, etc.) |
| 178: | * |
| 179: | * @return Ui5ArtifactInterface[] |
| 180: | */ |
| 181: | public function getAllArtifacts(): array; |
| 182: | } |
| 183: |