Audience: Engineers. What this answers: the entity model, the two workflows (template approval, employee completion), and how smart text and signatories fit.

Source: DocumentService.cs (1,218), AdminDocumentsService.cs (317), Employee/DocumentsService.cs (106), the Document* / SmartText / Signatory entities (TenantDb), DocumentModel.cs, plus a live pass 2026-07-20.


1. Entity graph (TenantDb, CompanyId-scoped)

DocumentTemplateType (Offer=1, Employee document=2, Company document=3)
   └─< DocumentTemplate ──> DocumentTemplateStatus (In progress/Completed/Approved/Declined)
          │  Contents, Alias, Url, FileDate, ReviewDate
          │  IsDefault, IsForNewEmployees, IsForExistingEmployees, IsSignatureRequired
          │  SignaturePersonId, Signature, SignatureDate      ← the company's counter-signature
          └─< EmployeeDocument ──> Person
                 Signature, ActionDate                        ← the employee's completion

SmartText      Alias, Description, IsForOffer, IsForRequest,
               IsForOnboardingNote, IsForAnniversary, IsForHiring

Signatory      PersonId, IsPrimary, CompanyId

DocumentPolicy ──< DocumentPolicyItem      IsEmployeeEnabled, PolicyTypeId → PolicyType

Read models: ViewDocumentTemplate, ViewEmployeeDocument, ViewSignatory, ViewDocumentPolicyItem.

2. Template types (DocumentTemplateTypeParams)

Const Value Int
OFFER "Offer" 1
EMPLOYEE_DOCUMENT "Employee document" 2
COMPANY_DOCUMENT "Company document" 3

Type 1 is consumed by Hiring via Offer.DocumentTemplateId. Type 3 is platform-issued, absent from the tenant's create flow (RFD-002).

3. Two distinct workflows

A. Template lifecycle (DocumentTemplateStatuParams)

In progress (1) → Completed (2) → Approved (3)
                                 ↘ Declined (4)

Driven by Admin/Documents/Approve and /Decline. A template must clear this before issue — the control that stops unreviewed legal text reaching staff.

B. Employee completion

Admin/Documents/Assign  → creates EmployeeDocument (PersonId + DocumentTemplateId)
        │
        ├── Employee/Documents/Sign        → Signature + ActionDate
        └── Employee/Documents/Acknowledge → ActionDate only
        │
Admin/Documents/Recall  → withdraws the assignment

Which action applies is governed by the template's IsSignatureRequired. Models: SignDocumentTemplateModel, AcknowledgeDocumentTemplateModel, NewDocumentTemplateAssignmentModel.

Two signatures, two meanings. DocumentTemplate.Signature is the company's counter-signature (with SignaturePersonId → a Signatory). EmployeeDocument.Signature is the employee's. Don't conflate them. (RFD-001)

4. Smart text is context-tagged

SmartText carries five boolean context flags rather than a single category:

IsForOffer · IsForRequest · IsForOnboardingNote · IsForAnniversary · IsForHiring