# Specification: Auto-Inference Rules

> Reference for step-03a1-setup.md — convention/override depth auto-generation from entity definitions.

## Entity Attribute → SmartTable Column

| Attribute Type | Column Format | Sortable | Filterable | Notes |
|---|---|---|---|---|
| string + unique | text | yes | yes | clickAction: navigate:detail |
| string | text | yes | yes | — |
| enum / status | badge | yes | yes (multi-select) | colorMap from lifeCycles if exists |
| FK:Entity | text (join .name) | yes | yes (entity-select) | Display related entity name |
| decimal | currency | yes | no | — |
| int | number | yes | no | — |
| datetime | date-relative | yes | yes (date-range) | — |
| bool | boolean | yes | yes (toggle) | — |
| text (long) | — | no | no | Hidden in table, visible in detail |

## Entity Attribute → SmartForm Field

| Attribute Type | Component | Required from | Notes |
|---|---|---|---|
| string | Input | entity.required | — |
| string (multiline) | TextArea | entity.required | rows: 4 |
| enum | Select | entity.required | source: enum name |
| FK:Entity | EntitySelect | entity.required | source: target entity, searchable |
| decimal | NumberInput | entity.required | — |
| int | NumberInput | entity.required | — |
| datetime | DatePicker | entity.required | — |
| bool | Toggle | — | default: false |

## Auto-Generated Sections by featureType

| featureType | Sections generated |
|---|---|
| data-centric | list, create, detail |
| workflow | list, create, detail, edit |
| integration | list, detail, config |
| reporting | dashboard |
| full-module | list, create, detail, edit, dashboard |

## Section Generation Rules

1. **list section:** SmartTable with all non-long-text attributes as columns, actions = [view, edit, delete], defaultSort = { createdAt, desc }
2. **create section:** SmartForm with all writable attributes as fields, component inferred from type
3. **detail section:** DetailCard with all attributes + child SmartTable for each 1:N relationship
4. **edit section:** Same as create but pre-filled (mode: edit)
5. **dashboard section:** Trigger 3d (dashboard specification)

## Status/Lifecycle Enhancement

If entity has a status/enum field AND lifeCycles exists:
- list section: status column gets `format: badge`, `colorMap: stateMachine:{Entity}`
- list section: rowActions get `showWhen` conditions based on state machine transitions
- detail section: add StatusBadge resource + transition action buttons

Write auto-generated sections to `specification.sections[]` via `ba-writer.enrichSection()`
