# SmartStack Entity Convention Guards (step-03-specify)

Before finalizing each entity, apply these rules:

## B-bis-1. Person Extension Pattern

(ref: `entity-architecture-decision.md` section 0)

IF the entity matches a person role (Employee, Customer, Manager, Consultant, etc.):
- **DO NOT** add firstName, lastName, email, phoneNumber as direct attributes
- **DO** add `userId` (type: `string`, FK to auth_Users — ASP.NET Identity uses string IDs)
- **DO** add `personRoleConfig` metadata with variant (mandatory/optional)
- Personal fields come from User, not from the domain entity

## B-bis-2. Versioned Sensitive Data

IF the entity has attributes that change over time with audit requirements (salary, rate, grade):
- **DO NOT** put them directly on the entity as single fields
- **DO** extract into a versioned satellite table (e.g., Employee → Salary with effectiveDate)
- Mark with `"versionedAttributes"` in entity spec

## B-bis-3. SmartStack Socle Entities (NEVER redefine)

- Users/Identity → `auth_Users` (managed by SmartStack Identity)
- Tenants → `tenant_Tenants` (managed by SmartStack Core)
- Departments → `ref_Departments` or `rh_Departments` (check if exists in target DB)

## B-bis-4. Foreign Key Conventions

- All FK attributes MUST end with `Id` suffix (e.g., `departmentId`, `userId`)
- FK to Identity users MUST use type `string` (ASP.NET Identity convention, NOT guid)
- FK to domain entities MUST use type `guid`
