Organization Core & Hierarchy
Defines the physical and legal hierarchy of tenants, including business units, branches, sites, and departments.
The Organization Core module models the enterprise organizational chart and multi-facility topology for SCRIPE tenants. It establishes a six-tier hierarchy spanning legal entities, strategic business units, regional branches, physical campus sites, and operational departments, providing strict operational scoping across all downstream modules.
Organizational Architecture
Designed to model complex holding companies, multi-franchise academies, and regional sports complexes.
Legal Entities
Formal corporate registrations with distinct tax identification numbers, official commercial records, and statutory jurisdictions.
Strategic Business Units
Divisional segmentation (e.g. Elite Academy, Commercial Venue Rentals, Retail Operations) for P&L tracking.
Regional Branches
Geographic operational centers responsible for regional logistics, staff rosters, and financial settlements.
Physical Campuses & Sites
Real-world real estate complexes, stadiums, training grounds, and facilities mapped with geo-location coordinates.
Departments & Squads
Functional working groups (Coaching, Medical, Operations, Maintenance) enabling fine-grained workforce assignment.
Operational Teams
Tactical task forces and coaching squads assembled for specific tournaments, age brackets, or seasonal events.
Domain Aggregate Root: LegalEntity
The LegalEntity aggregate root governs corporate tax configurations, operational branch registries, and organizational events.
public sealed class LegalEntity : TenantAggregateRoot
{
public string Code { get; private set; } = string.Empty;
public string LegalNameEn { get; private set; } = string.Empty;
public string LegalNameAr { get; private set; } = string.Empty;
public string TaxRegistrationNumber { get; private set; } = string.Empty;
public string JurisdictionCountryCode { get; private set; } = "SA";
public List<BusinessUnit> BusinessUnits { get; private set; } = new();
public List<Branch> Branches { get; private set; } = new();
public Result AddBranch(string branchCode, string nameEn, string nameAr, Guid siteId)
{
if (Branches.Any(b => b.Code == branchCode))
return Result.Failure("Branch with code already exists within this legal entity.");
var branch = new Branch(Id, TenantId, branchCode, nameEn, nameAr, siteId);
Branches.Add(branch);
RaiseDomainEvent(new BranchCreatedDomainEvent(branch.Id, TenantId, Id, branchCode));
return Result.Success();
}
}6-Tier Hierarchy Tree & Scoping Resolution Pipeline
How data and permissions cascade downward through the organizational topology:
Multilingual Branch Lookup
Branch lookup uses versioned Unicode-aware normalization for Arabic and Latin names. It retrieves candidates from a tenant-scoped search-term index, using trigrams plus bigrams for four- and five-rune tokens so accepted short typos reach the fuzzy scorer. Tokens shorter than four runes require an exact match; longer tokens tolerate one edit. Results are deterministic and page sizes are capped at 100.
Primary API Endpoints
Key endpoints exposed by OrganizationCoreControllers for legal entity configuration, branch hierarchy, and site queries.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/v1/organization-core/legal-entities | List registered corporate legal entities with tax configurations | 🔒 Required |
| POST | /api/v1/organization-core/legal-entities | Incorporate a new legal entity within tenant scope | 🔒 Required |
| GET | /api/v1/organization-core/business-units | Query strategic business units and operational divisions | 🔒 Required |
| GET | /api/v1/organization-core/branches | Retrieve operational branches with regional site mappings | 🔒 Required |
| POST | /api/v1/organization-core/branches | Register a new branch linked to an existing legal entity | 🔒 Required |
| GET | /api/v1/organization-core/sites | List physical campus sites, training centers, and sports complexes | 🔒 Required |