using Distribution.Models; using Microsoft.EntityFrameworkCore; namespace Distribution.Data.Seed; public static class CommerceSeed { private static readonly Guid PriceList1Id = new("39000000-0000-0000-0000-000000000001"); private static readonly Guid PriceListItem1Id = new("40000000-0000-0000-0000-000000000001"); private static readonly Guid PriceListItem2Id = new("40000000-0000-0000-0000-000000000002"); private static readonly Guid Scheme1Id = new("48000000-0000-0000-0000-000000000001"); private static readonly Guid Scheme2Id = new("48000000-0000-0000-0000-000000000002"); private static readonly Guid SchemeBundleComponent1Id = new("49000000-0000-0000-0000-000000000001"); private static readonly Guid SchemeRedemption1Id = new("50000000-0000-0000-0000-000000000001"); private static readonly Guid Payment1Id = new("47000000-0000-0000-0000-000000000001"); private static readonly Guid Payment2Id = new("47000000-0000-0000-0000-000000000002"); private static readonly Guid Payment3Id = new("47000000-0000-0000-0000-000000000003"); private static readonly Guid Payment4Id = new("47000000-0000-0000-0000-000000000004"); private static readonly Guid SaleReturn1Id = new("51000000-0000-0000-0000-000000000001"); private static readonly Guid SaleReturnItem1Id = new("52000000-0000-0000-0000-000000000001"); private static readonly Guid CreditNote1Id = new("54000000-0000-0000-0000-000000000001"); private static readonly Guid Claim1Id = new("53000000-0000-0000-0000-000000000001"); public static void Apply(ModelBuilder modelBuilder) { modelBuilder.Entity().HasData( new PriceList { Id = PriceList1Id, Name = "Western Province Price List", FK_RegionId = MasterDataSeed.WesternRegionId, EffectiveFrom = new DateTime(2026, 1, 1), EffectiveTo = new DateTime(2026, 12, 31), CreatedAt = new DateTime(2026, 8, 1), IsActive = true } ); modelBuilder.Entity().HasData( new PriceListItem { Id = PriceListItem1Id, FK_PriceListId = PriceList1Id, FK_ItemId = MasterDataSeed.Coke500ItemId, Price = 60m, MinPrice = 55m, CreatedAt = new DateTime(2026, 8, 1), IsActive = true }, new PriceListItem { Id = PriceListItem2Id, FK_PriceListId = PriceList1Id, FK_ItemId = MasterDataSeed.LaysClassicItemId, Price = 50m, MinPrice = 45m, CreatedAt = new DateTime(2026, 8, 1), IsActive = true } ); modelBuilder.Entity().HasData( new Scheme { Id = Scheme1Id, Name = "Buy 10 Coke Get 1 Free", RuleType = SchemeRuleType.BuyXGetY, RuleConfig = null, FK_TriggerItemId = MasterDataSeed.Coke500ItemId, TriggerQty = 10, FK_FreeItemId = MasterDataSeed.Coke500ItemId, FreeQty = 1m, FK_RegionId = MasterDataSeed.WesternRegionId, EligibleSegment = null, DateRangeFrom = new DateTime(2026, 8, 1), DateRangeTo = new DateTime(2026, 12, 31), AgentLimitExempt = false, BaselineExpectedSales = 500000m, CreatedAt = new DateTime(2026, 8, 1), IsActive = true }, new Scheme { Id = Scheme2Id, Name = "Snack Combo Bundle", RuleType = SchemeRuleType.FreeBundle, RuleConfig = null, FK_TriggerItemId = null, TriggerQty = null, FK_FreeItemId = MasterDataSeed.LaysFamilyItemId, FreeQty = 1m, FK_RegionId = MasterDataSeed.CentralRegionId, EligibleSegment = null, DateRangeFrom = new DateTime(2026, 8, 1), DateRangeTo = new DateTime(2026, 12, 31), AgentLimitExempt = false, BaselineExpectedSales = null, CreatedAt = new DateTime(2026, 8, 1), IsActive = true } ); modelBuilder.Entity().HasData( new SchemeBundleComponent { Id = SchemeBundleComponent1Id, FK_SchemeId = Scheme2Id, FK_ItemId = MasterDataSeed.LaysClassicItemId, Qty = 5 } ); modelBuilder.Entity().HasData( new SchemeRedemption { Id = SchemeRedemption1Id, FK_SchemeId = Scheme1Id, FK_ShopPOId = OperationsDataSeed.ShopPO1Id, FieldInvoiceId = null, DiscountAmount = 0m, FK_FreeItemId = MasterDataSeed.Coke500ItemId, FreeQty = 1m, FreeItemCostValue = 40m, RedeemedAt = new DateTime(2026, 8, 25, 9, 30, 0) } ); modelBuilder.Entity().HasData( new Payment { Id = Payment1Id, FK_InvoiceId = OperationsDataSeed.Invoice1Id, Amount = 3000m, Method = PaymentMethod.Cash, EntryMode = EntryMode.RealTime, CollectedAt = new DateTime(2026, 8, 25, 9, 30, 0), CollectedBy = MasterDataSeed.SalesRep1UserId, CreatedAt = new DateTime(2026, 8, 25, 9, 30, 0), IsActive = true }, new Payment { Id = Payment2Id, FK_InvoiceId = OperationsDataSeed.Invoice2Id, Amount = 1000m, Method = PaymentMethod.Cash, EntryMode = EntryMode.RealTime, CollectedAt = new DateTime(2026, 8, 31, 9, 20, 0), CollectedBy = MasterDataSeed.SalesRep2UserId, CreatedAt = new DateTime(2026, 8, 31, 9, 20, 0), IsActive = true }, new Payment { Id = Payment3Id, FK_InvoiceId = OperationsDataSeed.Invoice2Id, Amount = 800m, Method = PaymentMethod.Cheque, EntryMode = EntryMode.DayEndManual, ChequeNumber = "000456", ChequeDate = new DateTime(2026, 8, 31), CollectedAt = new DateTime(2026, 8, 31, 11, 0, 0), CollectedBy = MasterDataSeed.SalesRep2UserId, RecordedBy = MasterDataSeed.Supervisor1UserId, CreatedAt = new DateTime(2026, 8, 31, 18, 0, 0), IsActive = true }, new Payment { Id = Payment4Id, FK_InvoiceId = OperationsDataSeed.Invoice2Id, Amount = 300m, Method = PaymentMethod.Credit, EntryMode = EntryMode.RealTime, CollectedAt = new DateTime(2026, 8, 31, 11, 5, 0), CollectedBy = MasterDataSeed.SalesRep2UserId, CreatedAt = new DateTime(2026, 8, 31, 11, 5, 0), IsActive = true } ); modelBuilder.Entity().HasData( new SaleReturn { Id = SaleReturn1Id, FK_ShopPOId = OperationsDataSeed.ShopPO1Id, Mode = ReturnMode.CreditDeduction, TotalCreditAmount = 300m, CreatedByUserId = MasterDataSeed.SalesRep1UserId, CreatedAt = new DateTime(2026, 8, 26), IsActive = true } ); modelBuilder.Entity().HasData( new SaleReturnItem { Id = SaleReturnItem1Id, FK_SaleReturnId = SaleReturn1Id, FK_ItemId = MasterDataSeed.Coke500ItemId, Quantity = 5m, ReasonCode = ReturnReasonCode.Damaged, UnitPrice = 60m, CreatedAt = new DateTime(2026, 8, 26), IsActive = true } ); modelBuilder.Entity().HasData( new CreditNote { Id = CreditNote1Id, FK_SaleReturnId = SaleReturn1Id, Amount = 300m, IssuedAt = new DateTime(2026, 8, 26), CreatedAt = new DateTime(2026, 8, 26), IsActive = true } ); modelBuilder.Entity().HasData( new Claim { Id = Claim1Id, FK_AgencyUserId = OperationsExtrasSeed.RegionalAgency1UserId, Details = "Distributor margin claim for Q3 promotional shortfall", Status = ClaimStatus.Settled, SettlementAmount = 15000m, SettledByUserId = MasterDataSeed.RegionalManager1UserId, SettledAt = new DateTime(2026, 8, 28), CreatedAt = new DateTime(2026, 8, 27), IsActive = true } ); } }