1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Edm\Contracts;
6:
7: use LaravelUi5\OData\Edm\EdmPrimitiveType;
8:
9: /**
10: * Declares a typed column schema: column names with their primitive types
11: * and the key columns that uniquely identify a row.
12: *
13: * This is the common denominator between OData entity sets (where parameters
14: * arrive via $filter) and Core artifact types like Report, AnalyticsSet, and
15: * ValueHelp (where parameters arrive via artifact-specific mechanisms).
16: *
17: * The interface captures only the schema — "I produce typed rows with this
18: * shape" — without prescribing how the data is queried or how parameters
19: * are supplied. That responsibility belongs to the consuming layer:
20: *
21: * - In odata: {@see \LaravelUi5\OData\Service\AbstractEntitySet} implements
22: * this interface and inherits SQL query execution from SqlEntitySetResolver.
23: * - In Core: SqlQueryInterface extends this interface and adds the query
24: * source contract for Report/AnalyticsSet/ValueHelp artifacts.
25: *
26: * @see EdmPrimitiveType for the available column types
27: */
28: interface ColumnarSchemaInterface
29: {
30: /**
31: * Flat column definitions.
32: *
33: * Each value is either an {@see EdmPrimitiveType} case (for primitive
34: * columns) or the class-string of an int-backed PHP enum that should
35: * project to an {@see \LaravelUi5\OData\Edm\Contracts\Type\EnumTypeInterface}
36: * — the OData engine reflects the enum, registers it on the schema,
37: * and emits the symbolic member name on the wire.
38: *
39: * @return array<string, EdmPrimitiveType|class-string<\BackedEnum>>
40: */
41: public function columns(): array;
42:
43: /**
44: * Primary key column name(s).
45: *
46: * @return list<string>
47: */
48: public function key(): array;
49: }
50: