# Rule: Naming conventions for modeler contracts

## File extensions (observed in `src/`)

| Artifact              | Extension                   | Example file                                     |
| --------------------- | --------------------------- | ------------------------------------------------ |
| DataSource            | `.datasource.xml`           | `DsBoVisit_sf.datasource.xml`                    |
| BusinessObject        | `.businessobject.xml`       | `BoVisit.businessobject.xml`                     |
| BusinessObject helper | `.businessobjecthelper.xml` | `BoHelperDriverCockpit.businessobjecthelper.xml` |
| ListObject            | `.listobject.xml`           | `LoVisit.listobject.xml`                         |
| ListItem              | `.listitem.xml`             | `LiVisit.listitem.xml`                           |
| LookupObject          | `.lookupobject.xml`         | `LuProduct.lookupobject.xml`                     |
| Process               | `.processflow.xml`          | `Visit_LoadVisitProcess.processflow.xml`         |
| UI                    | `.userinterface.xml`        | `Call_RescheduleCallUI.userinterface.xml`        |
| Print Layout v2       | `.printlayoutv2.xml`        | `OrderConfirmationPDF.printlayoutv2.xml`         |
| Validation messages   | `.validationmessages.xml`   | `BoVisit.validationmessages.xml`                 |
| Business logic        | `.bl.js`                    | `BoVisit.GetDetails.bl.js`                       |
| DB table              | `.dbtable.xml`              | shipped rarely; read-only for most cases         |
| Plugin                | `.plugin.xml`               | `BLConstants.plugin.xml`                         |

## Name prefixes (observed in `src/`)

| Prefix                       | Artifact              |
| ---------------------------- | --------------------- |
| `Ds<Kind><Name>`             | DataSource            |
| `Bo<Name>`                   | BusinessObject        |
| `BoHelper<Name>`             | BusinessObject helper |
| `Lo<Name>`                   | ListObject            |
| `Li<Name>`                   | ListItem              |
| `Lu<Name>`                   | LookupObject          |
| `<Module>_<FlowName>Process` | Process               |
| `<Module>_<FlowName>UI`      | UI page               |
| `<Descriptive>PDF`           | Print layout (v2)     |

`<Kind>` inside DataSource names:

-   `Bo` → feeds a BusinessObject (e.g., `DsBoVisit`)
-   `Lo` → feeds a ListObject (e.g., `DsLoVisitMap`)
-   `Lu` → feeds a LookupObject (e.g., `DsLuProduct`)

## Module folder layout

Each module under `src/<ModuleName>/` organizes files into subfolders:

```
src/Visit/
├── BO/          ← BusinessObjects, ListObjects, LookupObjects (all "object-like" contracts)
│   ├── BoVisit/
│   │   ├── BoVisit.businessobject.xml
│   │   ├── BoVisit.validationmessages.xml
│   │   └── Mv2/                              ← method-version-2 .bl.js files
│   ├── LoVisit/
│   │   ├── LoVisit.listobject.xml
│   │   └── LiVisit.listitem.xml
│   └── LuProduct/
│       └── LuProduct.lookupobject.xml
├── DS/          ← DataSources (all of them, regardless of what they feed)
├── PR/          ← Process flows AND their bundled UI files
│   └── Visit_LoadVisit/
│       ├── Visit_LoadVisitProcess.processflow.xml
│       └── Visit_LoadVisitUI.userinterface.xml
└── PL/          ← Print layouts (where present)
```

**Important:** UI files live next to the process that owns them in `PR/<FlowName>/<FlowName>UI.userinterface.xml` — NOT in a separate `UI/` folder.

**Important:** LO/LU live under `BO/` alongside BOs, one folder per artifact. The folder name matches the artifact name.

Place new artifacts following these patterns of the target module.

## File suffix conventions

-   DataSources ship as `*_sf.datasource.xml` when they wrap a Salesforce-backed (sync-layer) table. Custom DSs that read from synced tables should follow the same suffix.
-   Pure local / context-menu / scripted DSs drop the `_sf` suffix.

## Naming rules

-   PascalCase for the `<Name>` portion
-   No underscores inside `<Name>`; use PascalCase boundaries (except in process/UI flow names which use `<Module>_<FlowName>`)
-   Match the target entity/table exactly when feasible (`DsBoVisit` reads `Visit`, `BoVisit` wraps it)
