# Implement Domain Models ## Summary Implement all domain model entities for the JDE Scoping Tool as defined in the domain-models specification. This establishes the core business entity layer for the .NET 10 migration, providing strongly-typed classes for JDE/CMS data representation, search criteria, and data transfer. ## Scope ### In Scope - **Core entities** (4): Search, SearchCriteria, SearchStatus, SearchUpdate - **Work order entities** (5): WorkOrder, WorkOrderStep, WorkOrderTime, WorkOrderComponent, WorkOrderRouting - **Lot entities** (3): Lot, LotUsage, LotLocation - **Reference entities** (8): Item, WorkCenter, ProfitCenter, Branch, JdeUser, StatusCode, FunctionCode, IBusinessUnit - **Config entities** (3): DataUpdate, OrgHierarchy, RouteMaster - **CMS entities** (1): MisData - **Auth entities** (1): UserInfo - **Support entities** (5): QueryTypes, TableSpec, ColumnSpec, UpdateTypes, StatusUpdate - **Additional types** (4): POReceiver, POInspect, DcsLot, CamstarMO - **ViewModels** for projections - **Extension methods** for ToViewModel() conversions - **JdeDateConverter** static helper for JDE date/time conversion ### Out of Scope - Database repository implementations (covered by data-access spec) - Service layer validation logic - SignalR hub implementations (web-api-auth spec) - Database schema (separate migrate-database-schema change) ## Motivation The domain models are foundational to all other migration work. They provide: - Type-safe representation of JDE/CMS manufacturing data - Nullable reference type annotations for improved null safety - System.Text.Json serialization compatibility for modern API communication - Extension method projections for clean DTO separation ## Acceptance Criteria 1. All 52 requirements from `domain-models/spec.md` are implemented 2. Solution builds successfully with `dotnet build` 3. Nullable reference types enabled and all annotations applied per spec 4. All enums use `[JsonConverter(typeof(JsonStringEnumConverter))]` 5. JdeDateConverter handles edge cases (zero/invalid dates return null) 6. ToViewModel() extension methods exist for entities that require them 7. IBusinessUnit interface implemented by WorkCenter and ProfitCenter 8. `openspec validate implement-domain-models --strict` passes ## Dependencies - Phase 1 (Solution Structure) - completed - Phase 2 (Database Schema) - in progress, but domain models are independent ## Risks | Risk | Mitigation | |------|------------| | Property name mismatch with legacy | Cross-reference spec against OLD/DataModel/Models/*.cs | | Missing nullable annotations | Use spec's explicit nullable annotation list | | JDE date conversion errors | Unit tests for edge cases (zero dates, invalid formats) | | Serialization incompatibility | Test JSON round-trip for all entities | ## Related Specs - `domain-models` - Primary specification for this change - `database-schema` - Table definitions that entities map to - `data-access` - Repositories that consume these entities