# curated.pos_table_definitions

## Purpose

This table stores more structural table-definition metadata than `curated.pos_tables`. It is intended for layouts, parent-child table relationships, and table configuration rules that are more static than transactional dine-in activity.

Consumers can use it to understand table hierarchy, ownership, and allocation limits in the POS model.

## Schema contract

The deployed SQL under `backend/Kds.Ai.Warehouse/Sql/Bootstrap/Tenant/Curated/` is the source of truth for the current column names, types, and nullability.

## Column groups

- Business properties describe the business entity, event, fact, or reference record represented by the table.
- Technical and ETL properties describe warehouse lineage, surrogate keys, source reconciliation, tenant scoping, slowly changing dimension controls, and ingestion metadata.

## Business properties

| Column | Type | Nullable | Business Meaning | Notes |
|---|---|---|---|---|
| `tableid` | `INTEGER` | Yes | Identifier of the table definition. |  |
| `name` | `VARCHAR(60)` | Yes | Human-readable table definition name. |  |
| `type` | `INTEGER` | Yes | Table-definition type code from the source system. |  |
| `parent` | `INTEGER` | Yes | Parent table identifier for grouped or hierarchical layouts. |  |
| `maxadd` | `INTEGER` | Yes | Maximum additional capacity or extension value for the table. |  |
| `table_type_name` | `VARCHAR(255)` | Yes | Readable business label for the table-definition type. |  |
| `parent_table_name` | `VARCHAR(255)` | Yes | Readable name of the parent table definition when applicable. |  |
| `zone_name` | `VARCHAR(255)` | Yes | Readable dining zone or area name associated with the table definition. |  |
| `is_active` | `BOOLEAN` | Yes | Canonical flag indicating whether the table definition is active in the curated model. |  |

## Technical and ETL properties

| Column | Type | Nullable | Technical Meaning | Notes |
|---|---|---|---|---|
| `table_definition_key` | `BIGINT` | Yes | Stable warehouse key for the table definition entity. |  |
| `source_system` | `VARCHAR(100)` | Yes | Canonical name of the source platform that produced the table definition row. |  |
| `source_table_definition_id` | `VARCHAR(199)` | Yes | Original table definition identifier from the source platform. |  |
| `tenant_key` | `BIGINT` | Yes | Stable warehouse key for the tenant, brand, or client that owns the table definition. |  |
| `tenant_name` | `VARCHAR(255)` | Yes | Readable tenant, brand, or client name associated with the table definition. |  |
| `effective_from_utc` | `TIMESTAMP` | Yes | UTC timestamp from which the current table-definition version is valid. |  |
| `effective_to_utc` | `TIMESTAMP` | Yes | UTC timestamp until which the current table-definition version is valid. |  |
| `is_current` | `BOOLEAN` | Yes | Canonical flag indicating whether the row is the current table-definition version. |  |
| `_etl_batch_id` | `VARCHAR(256)` | Yes | ETL batch lineage identifier. |  |
| `_etl_source_type` | `VARCHAR(100)` | Yes | Source adapter type used by ETL. |  |
| `_etl_ingested_at` | `TIMESTAMP` | No | Warehouse ingestion timestamp for the curated row. | Required ingestion audit timestamp. |
