Audience: backend engineers. How leave entitlement, accrual, balances, perks, holidays and absences are modelled and computed.
Companion: business.md, surface-map.md, requests/technical.md (the request engine).
Derived from the tenant entities in
src/Core.Backend.Domain/Entities/Tenant/+HolidayService,Paid_HolidaysService, and the leave paths inRequestService.cs.⚠️ VERIFYmarks items to confirm.
Leave has no dedicated service — the request lifecycle lives in RequestService (leave = request type 1), while this subsystem is primarily a rich entity model + HolidayService. The C# layer manages balances/accrual; holidays and working-day maths feed payroll's SQL engine.
flowchart TB
REQ[RequestService<br/>leave request lifecycle] --> BAL[EmployeeLeaveBalance<br/>+ Log]
POL[LeavePolicy + LeavePolicyItem<br/>entitlement rules] --> BAL
ACC[AccrualType + LeaveRequestTrigger<br/>accrual] --> BAL
POL --> PERK[LeavePerk / LeavePolicyPerk<br/>EmployeeLeavePerkBalance]
HOL[PublicHoliday / Paid_Holidays<br/>HolidayService] --> PAY[Payroll working-day maths]
BAL --> PAY
ABS[EmployeeAbsence + Review + Batch] --> PAY
LeavePolicy — Description, Alias, GenderId (gender-specific), IsPaid, IsEmployeeEnabled (self-apply), PolicyTypeId, CompanyId. Collections: items, perks, person containers.LeavePolicyItem — the per-paygrade entitlement: PaygradeId, AccrualTypeId, WorkingDays (entitlement), WaitingPeriod, HasRolloverLimit / RolloverDays / RolloverDate, NoticePeriod.LeavePolicyItemPersonContainer — materialises which people a policy item applies to (targeting).PolicyType — the leave-type classification.EmployeeLeaveBalance — PersonId, LeavePolicyId, CurrentBalance, StartingBalance (decimals — half-days supported).EmployeeLeaveBalanceLog — append-only history of every balance change (accrual, usage, rollover, manual adjustment). Views: ViewEmployeeLeaveBalance(Log).AccrualType — configurable lookup (Description) — the accrual scheme referenced by LeavePolicyItem.AccrualTypeId.LeaveRequestTrigger / ViewLeaveRequestTrigger — triggers that drive accrual/entitlement events. ⚠️ VERIFY the exact trigger cadence.