1: <?php
2:
3: namespace LaravelUi5\Core\Ui5\Contracts;
4:
5: use LaravelUi5\Core\Enums\AggregationLevel;
6: use LaravelUi5\Core\Ui5\Capabilities\KpiProviderInterface;
7:
8: /**
9: * Contract for UI5 KPI tiles embedded in dashboards or standalone views.
10: *
11: * Each KPI defines its own metadata, aggregation level, unit and optional scale,
12: * and references a data provider responsible for delivering dynamic content.
13: *
14: * KPIs are treated as first-class UI5 artifacts and must declare a unique
15: * namespace and version. This enables them to be listed, routed and managed
16: * like any other UI5 entity (App, Library, Card, etc.).
17: */
18: interface Ui5KpiInterface extends Ui5ArtifactInterface
19: {
20: /**
21: * Returns the aggregation level (e.g. daily, weekly, monthly).
22: *
23: * Indicates how the underlying data is grouped.
24: *
25: * @return AggregationLevel
26: */
27: public function getAggregationLevel(): AggregationLevel;
28:
29: /**
30: * Returns an array of context keys (e.g. 'project_id', 'year').
31: *
32: * These keys are expected as filters or parameters when requesting
33: * dynamic data via the data provider.
34: *
35: * @return string[]
36: */
37: public function getContextKeys(): array;
38:
39: /**
40: * Returns the data provider responsible for retrieving live KPI data.
41: *
42: * The provider will return the actual value, indicator, valueColor, etc.
43: * and is invoked at runtime inside the dashboard view.
44: *
45: * @return KpiProviderInterface
46: */
47: public function getProvider(): KpiProviderInterface;
48: }
49: