# ALLA OS Setup CSV Templates

This folder contains the supported static CSV template pack for Task D.7.3.

Rules:

- UTF-8 text.
- Comma delimiter.
- LF line endings.
- One header row and one safe sample row per CSV.
- No unsupported template files are generated.
- No production data, formulas, secrets, or binary references are included.

## Sample Dataset

All templates use one consistent sample dataset:

- Organization: `ALLA`
- Branch: `head_office`
- Product type: `crane`
- Currency: `THB`
- Administrator: `admin@example.com`
- Marketing: `mk.uat@example.com`
- Sales: `sales.uat@example.com`
- Manager: `manager.uat@example.com`
- CEO: `ceo.uat@example.com`
- Customer: `CUS-001`
- Lead: `LD-001`
- Opportunity: `OP-001`
- Quotation: `QT-HO-CR-2607-001`

## Import Order

| Order | File | Purpose |
| --- | --- | --- |
| 01 | `users.csv` | Setup-managed users |
| 02 | `organizations.csv` | Tenant organizations |
| 03 | `memberships.csv` | Organization memberships |
| 05 | `crm-role-assignments.csv` | CRM role assignments |
| 06 | `master-options.csv` | Generic master options |
| 07 | `branches.csv` | Branch options |
| 08 | `product-types.csv` | Product type options |
| 14 | `document-sequences.csv` | Document numbering |
| 15 | `approval-workflows.csv` | Approval workflows |
| 16 | `approval-steps.csv` | Approval workflow steps |
| 17 | `approval-matrix.csv` | Approval routing matrix |
| 30 | `customers.csv` | CRM customers |
| 32 | `contacts.csv` | Customer contacts |
| 33 | `contact-shares.csv` | Contact sharing grants |
| 34 | `leads.csv` | Marketing leads |
| 36 | `opportunities.csv` | Sales opportunities |
| 37 | `opportunity-parties.csv` | Opportunity project parties |
| 40 | `quotations.csv` | Quotation headers |
| 41 | `quotation-items.csv` | Quotation line items |
| 42 | `quotation-parties.csv` | Quotation project parties |
| 43 | `quotation-topics.csv` | Quotation topic headers |
| 44 | `quotation-topic-items.csv` | Quotation topic rows |

## Relationship Rules

- `organization_code` links rows to the organization import context.
- `user_email`, `created_by_email`, `updated_by_email`, and role-related email fields resolve to `users.email`.
- `branch_code` resolves to `ms_options` category `crm_branch`.
- `product_type_code` resolves to `ms_options` category `crm_product_type`.
- `customer_code`, `lead_code`, `opportunity_code`, and `quotation_code` are business keys within the organization.
- `topic_key` is an import-only alias linking `quotation-topics.csv` to `quotation-topic-items.csv`.
- Pipe-delimited fields, such as permission or scope lists, use `|`.

## Placeholders

These templates intentionally leave sensitive or runtime values empty:

- `users.csv` has an empty `password` sample value.
- Runtime approval and PDF artifact fields are not present.
- Binary attachment paths are not present.

## Unsupported Templates

The following files are documented but not generated because the current schema does not support them as safe first-class setup imports:

- `departments.csv`
- `teams.csv`
- `warehouses.csv`
- `sites.csv`
- `services.csv`
- `price-books.csv`
- `tax-rates.csv`
- `attachments.csv`
- `email-settings.csv`

See `docs/setup/csv-template-spec.md` and `docs/setup/import-mapping.md` for the full contract.
