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