From 2d6723a0407e5caabb1cb6f4954d0af02375d809 Mon Sep 17 00:00:00 2001 From: DeepnaPooja Date: Mon, 19 Oct 2026 15:48:45 +0530 Subject: [PATCH 1/4] Update dashboard --- .../DashboardReportController.cs | 28 +++ .../DashboardReport/DashboardReportDTOs.cs | 32 ++++ .../DashboardReportRepository.cs | 171 ++++++++++++++++++ .../DashboardReport/DashboardReportService.cs | 83 +++++++++ .../IDashboardReportRepository.cs | 16 ++ Distribution/Program.cs | 3 + 6 files changed, 333 insertions(+) create mode 100644 Distribution/Features/DashboardReport/DashboardReportController.cs create mode 100644 Distribution/Features/DashboardReport/DashboardReportDTOs.cs create mode 100644 Distribution/Features/DashboardReport/DashboardReportRepository.cs create mode 100644 Distribution/Features/DashboardReport/DashboardReportService.cs create mode 100644 Distribution/Features/DashboardReport/IDashboardReportRepository.cs diff --git a/Distribution/Features/DashboardReport/DashboardReportController.cs b/Distribution/Features/DashboardReport/DashboardReportController.cs new file mode 100644 index 0000000..219bc7c --- /dev/null +++ b/Distribution/Features/DashboardReport/DashboardReportController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Distribution.Features.DashboardReport; + +[ApiController] +[Route("api/reports/dashboard")] +public class DashboardReportController(DashboardReportService service) : ControllerBase +{ + [HttpGet("sales")] + public async Task Sales( + [FromQuery] DateTime? from, [FromQuery] DateTime? to, + [FromQuery] Guid? regionId, [FromQuery] Guid? categoryId) + { + var f = DashboardReportService.BuildFilter(from, to, regionId, categoryId, null); + var error = DashboardReportService.Validate(f); + return error is null ? Ok(await service.GetSalesSummaryAsync(f)) : BadRequest(new { message = error }); + } + + [HttpGet("inventory")] + public async Task Inventory( + [FromQuery] DateTime? from, [FromQuery] DateTime? to, + [FromQuery] Guid? warehouseId, [FromQuery] Guid? categoryId) + { + var f = DashboardReportService.BuildFilter(from, to, null, categoryId, warehouseId); + var error = DashboardReportService.Validate(f); + return error is null ? Ok(await service.GetInventorySummaryAsync(f)) : BadRequest(new { message = error }); + } +} diff --git a/Distribution/Features/DashboardReport/DashboardReportDTOs.cs b/Distribution/Features/DashboardReport/DashboardReportDTOs.cs new file mode 100644 index 0000000..5b034f1 --- /dev/null +++ b/Distribution/Features/DashboardReport/DashboardReportDTOs.cs @@ -0,0 +1,32 @@ +namespace Distribution.Features.DashboardReport; + +public record DashboardFilter(DateTime From, DateTime To, Guid? RegionId, Guid? CategoryId, Guid? WarehouseId); + +public record SalesTotals(decimal GrossSales, decimal ReturnValue, int Orders, decimal CostedSales, decimal CostOfSales); + +public record SalesKpis( + decimal GrossSales, decimal ReturnValue, decimal NetSales, int Orders, decimal AverageOrderValue, + decimal GrossProfit, decimal? GrossProfitMarginPercent); + +public record SalesKpiComparison(SalesKpis Current, SalesKpis Previous, DateTime PreviousFrom, DateTime PreviousTo); + +public record TrendPoint(string Period, decimal Sales, decimal Returns); + +public record NamedAmount(Guid? Id, string Name, decimal Amount); + +public record SalesSummaryResponse( + DateTime From, DateTime To, string Granularity, + SalesKpiComparison Kpis, List Trend, + List ByCategory, List ByRegion, List ByRep); + +public record PeriodAmount(DateTime Date, decimal Amount); + +public record MovementPoint(string Period, decimal Received, decimal Issued, decimal Net); + +public record WarehouseStockRow(Guid WarehouseId, string Name, decimal Quantity, decimal Value); + +public record CategoryValueRow(string Category, decimal Quantity, decimal Value); + +public record InventorySummaryResponse( + DateTime From, DateTime To, string Granularity, + List ValueByCategory, List ByWarehouse, List MovementTrend); diff --git a/Distribution/Features/DashboardReport/DashboardReportRepository.cs b/Distribution/Features/DashboardReport/DashboardReportRepository.cs new file mode 100644 index 0000000..1b2bb32 --- /dev/null +++ b/Distribution/Features/DashboardReport/DashboardReportRepository.cs @@ -0,0 +1,171 @@ +using Distribution.Data; +using Distribution.Models; +using Microsoft.EntityFrameworkCore; + +namespace Distribution.Features.DashboardReport; + +public class DashboardReportRepository(AppDBContext db) : IDashboardReportRepository +{ + private sealed class SoldLine + { + public DateTime Date { get; set; } + public Guid PoId { get; set; } + public decimal Value { get; set; } + public decimal? Cost { get; set; } + public Guid CategoryId { get; set; } + public string CategoryName { get; set; } = ""; + public Guid RegionId { get; set; } + public string RegionName { get; set; } = ""; + public Guid RepId { get; set; } + } + + // Same definition of "sold" as ProductReportRepository: fulfilled lines on non-cancelled POs + // whose invoice is Finalized, dated by Invoice.FinalizedAt. 'To' is inclusive (whole day). + private IQueryable SoldLines(DashboardFilter f) + { + var start = f.From.Date; + var end = f.To.Date.AddDays(1); + var q = + from li in db.ShopPOItems.AsNoTracking() + join inv in db.Invoices.AsNoTracking() on li.FK_ShopPOId equals inv.FK_ShopPOId + where inv.Status == InvoiceStatus.Finalized + && li.ShopPO.Status != ShopPOStatus.Cancelled + && inv.FinalizedAt >= start && inv.FinalizedAt < end + select new SoldLine + { + Date = inv.FinalizedAt!.Value.Date, + PoId = li.FK_ShopPOId, + Value = li.QuantityFulfilled * li.UnitPrice, + Cost = li.Item.CostPrice == null ? null : li.QuantityFulfilled * li.Item.CostPrice, + CategoryId = li.Item.FK_CategoryId, + CategoryName = li.Item.Category.Name, + RegionId = li.ShopPO.Store.Route.FK_RegionId, + RegionName = li.ShopPO.Store.Route.Region.Name, + RepId = li.ShopPO.RaisedById, + }; + if (f.RegionId.HasValue) q = q.Where(l => l.RegionId == f.RegionId.Value); + if (f.CategoryId.HasValue) q = q.Where(l => l.CategoryId == f.CategoryId.Value); + return q; + } + + private IQueryable ReturnLines(DashboardFilter f) + { + var start = f.From.Date; + var end = f.To.Date.AddDays(1); + var q = db.SaleReturnItems.AsNoTracking() + .Where(r => r.SaleReturn.CreatedAt >= start && r.SaleReturn.CreatedAt < end); + if (f.RegionId.HasValue) q = q.Where(r => r.SaleReturn.ShopPO.Store.Route.FK_RegionId == f.RegionId.Value); + if (f.CategoryId.HasValue) q = q.Where(r => r.Item.FK_CategoryId == f.CategoryId.Value); + return q; + } + + public async Task GetSalesTotalsAsync(DashboardFilter f) + { + var lines = SoldLines(f); + var gross = await lines.SumAsync(l => (decimal?)l.Value) ?? 0m; + var orders = await lines.Select(l => l.PoId).Distinct().CountAsync(); + var costed = lines.Where(l => l.Cost != null); + var costedSales = await costed.SumAsync(l => (decimal?)l.Value) ?? 0m; + var cost = await costed.SumAsync(l => l.Cost) ?? 0m; + var returns = await ReturnLines(f).SumAsync(r => (decimal?)(r.Quantity * r.UnitPrice)) ?? 0m; + return new SalesTotals(gross, returns, orders, costedSales, cost); + } + + public async Task> GetDailySalesAsync(DashboardFilter f) => + (await SoldLines(f).GroupBy(l => l.Date) + .Select(g => new { Date = g.Key, Amount = g.Sum(x => x.Value) }) + .ToListAsync()) + .Select(x => new PeriodAmount(x.Date, x.Amount)).ToList(); + + public async Task> GetDailyReturnsAsync(DashboardFilter f) => + (await ReturnLines(f).GroupBy(r => r.SaleReturn.CreatedAt.Date) + .Select(g => new { Date = g.Key, Amount = g.Sum(x => x.Quantity * x.UnitPrice) }) + .ToListAsync()) + .Select(x => new PeriodAmount(x.Date, x.Amount)).ToList(); + + public async Task> GetSalesByCategoryAsync(DashboardFilter f) => + (await SoldLines(f).GroupBy(l => new { l.CategoryId, l.CategoryName }) + .Select(g => new { g.Key.CategoryId, g.Key.CategoryName, Amount = g.Sum(x => x.Value) }) + .OrderByDescending(x => x.Amount).ToListAsync()) + .Select(x => new GroupAggregate(x.CategoryId, x.CategoryName, x.Amount)).ToList(); + + public async Task> GetSalesByRegionAsync(DashboardFilter f) => + (await SoldLines(f).GroupBy(l => new { l.RegionId, l.RegionName }) + .Select(g => new { g.Key.RegionId, g.Key.RegionName, Amount = g.Sum(x => x.Value) }) + .OrderByDescending(x => x.Amount).ToListAsync()) + .Select(x => new GroupAggregate(x.RegionId, x.RegionName, x.Amount)).ToList(); + + public async Task> GetSalesByRepAsync(DashboardFilter f) + { + var rows = await SoldLines(f).GroupBy(l => l.RepId) + .Select(g => new { RepId = g.Key, Amount = g.Sum(x => x.Value) }) + .OrderByDescending(x => x.Amount).Take(20).ToListAsync(); + var ids = rows.Select(r => r.RepId).ToList(); + var names = await db.Users.AsNoTracking().Where(u => ids.Contains(u.Id)) + .ToDictionaryAsync(u => u.Id, u => u.FullName); + return rows.Select(r => new GroupAggregate(r.RepId, names.GetValueOrDefault(r.RepId, "Unknown"), r.Amount)).ToList(); + } + + private IQueryable Balances(DashboardFilter f) + { + var q = db.StockBalances.AsNoTracking().AsQueryable(); + if (f.WarehouseId.HasValue) + q = q.Where(b => b.LocationType == LocationType.Warehouse && b.LocationId == f.WarehouseId.Value); + if (f.CategoryId.HasValue) q = q.Where(b => b.Item.FK_CategoryId == f.CategoryId.Value); + return q; + } + + // Value = quantity x cost price; items without a cost price contribute quantity only. + public async Task> GetStockValueByCategoryAsync(DashboardFilter f) => + (await Balances(f).GroupBy(b => b.Item.Category.Name) + .Select(g => new + { + Category = g.Key, + Quantity = g.Sum(x => x.Quantity), + Value = g.Sum(x => x.Quantity * (x.Item.CostPrice ?? 0m)), + }) + .OrderByDescending(x => x.Value).ToListAsync()) + .Select(x => new CategoryValueRow(x.Category, x.Quantity, x.Value)).ToList(); + + public async Task> GetStockByWarehouseAsync(DashboardFilter f) + { + var rows = await Balances(f).Where(b => b.LocationType == LocationType.Warehouse) + .GroupBy(b => b.LocationId) + .Select(g => new + { + Id = g.Key, + Quantity = g.Sum(x => x.Quantity), + Value = g.Sum(x => x.Quantity * (x.Item.CostPrice ?? 0m)), + }) + .ToListAsync(); + var ids = rows.Select(r => r.Id).ToList(); + var names = await db.Warehouses.AsNoTracking().Where(w => ids.Contains(w.Id)) + .ToDictionaryAsync(w => w.Id, w => w.Name); + return rows.Select(r => new WarehouseStockRow(r.Id, names.GetValueOrDefault(r.Id, "Unknown"), r.Quantity, r.Value)) + .OrderByDescending(r => r.Value).ToList(); + } + + // Received = purchase receipts + customer returns; Issued = sales + purchase returns + damages. + // Transfers, loads and adjustments are internal/signed and excluded from this trend. + public async Task> GetDailyMovementsAsync(DashboardFilter f) + { + var start = f.From.Date; + var end = f.To.Date.AddDays(1); + var q = db.StockMovements.AsNoTracking() + .Where(m => m.CreatedAt >= start && m.CreatedAt < end + && (m.Type == MovementType.PurchaseReceipt || m.Type == MovementType.CustomerReturn + || m.Type == MovementType.Sale || m.Type == MovementType.PurchaseReturn || m.Type == MovementType.Damage)); + if (f.CategoryId.HasValue) q = q.Where(m => m.Item.FK_CategoryId == f.CategoryId.Value); + if (f.WarehouseId.HasValue) + q = q.Where(m => m.ToLocationId == f.WarehouseId.Value || m.FromLocationId == f.WarehouseId.Value); + + var rows = await q.GroupBy(m => new { m.CreatedAt.Date, m.Type }) + .Select(g => new { g.Key.Date, g.Key.Type, Qty = g.Sum(x => x.Quantity) }) + .ToListAsync(); + return rows.GroupBy(r => r.Date) + .Select(g => (g.Key, + g.Where(r => r.Type is MovementType.PurchaseReceipt or MovementType.CustomerReturn).Sum(r => r.Qty), + g.Where(r => r.Type is MovementType.Sale or MovementType.PurchaseReturn or MovementType.Damage).Sum(r => r.Qty))) + .ToList(); + } +} diff --git a/Distribution/Features/DashboardReport/DashboardReportService.cs b/Distribution/Features/DashboardReport/DashboardReportService.cs new file mode 100644 index 0000000..e393d48 --- /dev/null +++ b/Distribution/Features/DashboardReport/DashboardReportService.cs @@ -0,0 +1,83 @@ +namespace Distribution.Features.DashboardReport; + +public class DashboardReportService(IDashboardReportRepository repo) +{ + public const int MaxRangeDays = 366; + private const int DailyGranularityMaxDays = 62; + + public static DashboardFilter BuildFilter(DateTime? from, DateTime? to, Guid? regionId, Guid? categoryId, Guid? warehouseId) + { + var end = (to ?? DateTime.Now).Date; + var start = (from ?? end.AddDays(-29)).Date; + return new DashboardFilter(start, end, regionId, categoryId, warehouseId); + } + + public static string? Validate(DashboardFilter f) + { + if (f.To < f.From) return "'to' must not be before 'from'."; + if ((f.To - f.From).TotalDays > MaxRangeDays) return $"Date range cannot exceed {MaxRangeDays} days."; + return null; + } + + private static bool Daily(DashboardFilter f) => (f.To - f.From).TotalDays <= DailyGranularityMaxDays; + + private static string Bucket(DateTime d, bool daily) => daily ? d.ToString("yyyy-MM-dd") : d.ToString("yyyy-MM"); + + private static SalesKpis ToKpis(SalesTotals t) + { + var net = t.GrossSales - t.ReturnValue; + var gp = t.CostedSales - t.CostOfSales; + return new SalesKpis( + t.GrossSales, t.ReturnValue, net, t.Orders, + t.Orders > 0 ? Math.Round(t.GrossSales / t.Orders, 2) : 0m, + gp, t.CostedSales > 0 ? Math.Round(gp / t.CostedSales * 100, 2) : null); + } + + public async Task GetSalesSummaryAsync(DashboardFilter f) + { + var days = (f.To - f.From).Days + 1; + var prev = f with { From = f.From.AddDays(-days), To = f.From.AddDays(-1) }; + var daily = Daily(f); + + var current = await repo.GetSalesTotalsAsync(f); + var previous = await repo.GetSalesTotalsAsync(prev); + var sales = await repo.GetDailySalesAsync(f); + var returns = await repo.GetDailyReturnsAsync(f); + + var trend = sales.Select(s => (s.Date, Sales: s.Amount, Returns: 0m)) + .Concat(returns.Select(r => (r.Date, Sales: 0m, Returns: r.Amount))) + .GroupBy(x => Bucket(x.Date, daily)) + .OrderBy(g => g.Key) + .Select(g => new TrendPoint(g.Key, g.Sum(x => x.Sales), g.Sum(x => x.Returns))) + .ToList(); + + static NamedAmount Map(GroupAggregate g) => new(g.Key, g.Name, g.Amount); + return new SalesSummaryResponse( + f.From, f.To, daily ? "day" : "month", + new SalesKpiComparison(ToKpis(current), ToKpis(previous), prev.From, prev.To), + trend, + (await repo.GetSalesByCategoryAsync(f)).Select(Map).ToList(), + (await repo.GetSalesByRegionAsync(f)).Select(Map).ToList(), + (await repo.GetSalesByRepAsync(f)).Select(Map).ToList()); + } + + public async Task GetInventorySummaryAsync(DashboardFilter f) + { + var daily = Daily(f); + var movements = (await repo.GetDailyMovementsAsync(f)) + .GroupBy(m => Bucket(m.Date, daily)) + .OrderBy(g => g.Key) + .Select(g => + { + var rec = g.Sum(x => x.Received); + var iss = g.Sum(x => x.Issued); + return new MovementPoint(g.Key, rec, iss, rec - iss); + }).ToList(); + + return new InventorySummaryResponse( + f.From, f.To, daily ? "day" : "month", + await repo.GetStockValueByCategoryAsync(f), + await repo.GetStockByWarehouseAsync(f), + movements); + } +} diff --git a/Distribution/Features/DashboardReport/IDashboardReportRepository.cs b/Distribution/Features/DashboardReport/IDashboardReportRepository.cs new file mode 100644 index 0000000..56c81fb --- /dev/null +++ b/Distribution/Features/DashboardReport/IDashboardReportRepository.cs @@ -0,0 +1,16 @@ +namespace Distribution.Features.DashboardReport; + +public record GroupAggregate(Guid? Key, string Name, decimal Amount); + +public interface IDashboardReportRepository +{ + Task GetSalesTotalsAsync(DashboardFilter f); + Task> GetDailySalesAsync(DashboardFilter f); + Task> GetDailyReturnsAsync(DashboardFilter f); + Task> GetSalesByCategoryAsync(DashboardFilter f); + Task> GetSalesByRegionAsync(DashboardFilter f); + Task> GetSalesByRepAsync(DashboardFilter f); + Task> GetStockValueByCategoryAsync(DashboardFilter f); + Task> GetStockByWarehouseAsync(DashboardFilter f); + Task> GetDailyMovementsAsync(DashboardFilter f); +} diff --git a/Distribution/Program.cs b/Distribution/Program.cs index e59efe5..ca74100 100644 --- a/Distribution/Program.cs +++ b/Distribution/Program.cs @@ -30,6 +30,7 @@ using Distribution.Features.Sync; using Distribution.Features.Uom; using Distribution.Features.User; using Distribution.Features.Vehicle; +using Distribution.Features.DashboardReport; using Distribution.Features.ProductReport; using Distribution.Features.Stock; using Distribution.Features.StockReport; @@ -71,6 +72,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); -- 2.52.0 From 3c75f9786e58a2e9aa0aecf62ce04d05e5eb3b72 Mon Sep 17 00:00:00 2001 From: DeepnaPooja Date: Mon, 19 Oct 2026 15:51:39 +0530 Subject: [PATCH 2/4] Add multi-series charts and enhance dashboard functionality --- .../_components/analytics-sections.tsx | 345 +++++++++++++++++ .../_components/dashboard-charts.tsx | 86 ++++- .../_components/dashboard-client.tsx | 365 ++++++++---------- distribution_fe/lib/api/index.ts | 2 +- distribution_fe/lib/api/reports.ts | 38 ++ 5 files changed, 621 insertions(+), 215 deletions(-) create mode 100644 distribution_fe/app/(dashboard)/_components/analytics-sections.tsx diff --git a/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx b/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx new file mode 100644 index 0000000..e3ef94a --- /dev/null +++ b/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx @@ -0,0 +1,345 @@ +'use client' + +import { useEffect, useState, type ReactNode } from 'react' + +import { Skeleton } from '@/components/ui/skeleton' +import { toast } from '@/components/ui/toast' +import { dashboardReports, productReports, stockReports, getApiError, getPaginatedItems } from '@/lib/api/index' +import type { DashboardInventorySummary, DashboardSalesSummary, ProductSalesRow, SalesKpis, StockOverview } from '@/lib/api/reports' +import { DonutChart, MultiAreaChart, seriesColor } from './dashboard-charts' + +export interface DateRange { + from: string // yyyy-MM-dd + to: string +} + +const fmtMoney = (v: number) => `Rs. ${v.toLocaleString('en-LK', { maximumFractionDigits: 0 })}` +const fmtNum = (v: number) => v.toLocaleString('en-LK', { maximumFractionDigits: 2 }) + +function ChartCard({ title, note, children, className = '' }: { title: string; note?: string; children: ReactNode; className?: string }) { + return ( +
+
+
+ + {title} +
+ {note &&
{note}
} +
+
{children}
+
+ ) +} + +function Delta({ current, previous }: { current: number; previous: number }) { + if (previous === 0) return No previous-period data + const pct = ((current - previous) / Math.abs(previous)) * 100 + const up = pct >= 0 + return ( + + + {up ? '▲' : '▼'} {Math.abs(pct).toFixed(1)}% + + vs prev. + + ) +} + +function Kpi({ title, value, footer }: { title: string; value: string; footer?: ReactNode }) { + return ( +
+
+
{title}
+
{value}
+
+ {footer &&
{footer}
} +
+ ) +} + +function LoadingGrid() { + return ( +
+ {Array.from({ length: 8 }).map((_, i) => )} +
+ ) +} + +function useLoad(load: () => Promise, deps: unknown[], failTitle: string) { + const key = JSON.stringify(deps) + const [result, setResult] = useState<{ key: string; data: T | null } | null>(null) + useEffect(() => { + let cancelled = false + load() + .then(data => { if (!cancelled) setResult({ key, data }) }) + .catch(err => { + if (cancelled) return + toast.add({ title: failTitle, description: getApiError(err), type: 'error' }) + setResult({ key, data: null }) + }) + return () => { cancelled = true } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [key]) + // Loading until the response for the *current* deps has arrived, so a changed range shows the skeleton again. + return { data: result?.key === key ? result.data : null, loading: result?.key !== key } +} + +function Empty({ text }: { text: string }) { + return

{text}

+} + +/** Ranked list with an inline share bar — friendlier than a bar chart for "top N" comparisons. */ +function RankTable({ rows, fmt, empty, barClass = 'bg-primary' }: { + rows: Array<{ name: string; value: number; extra?: string }> + fmt: (v: number) => string + empty: string + barClass?: string +}) { + if (rows.length === 0 || rows.every(r => r.value === 0)) return + const max = Math.max(...rows.map(r => r.value), 1) + return ( +
+ + + {rows.map((r, i) => ( + + + + + + ))} + +
{i + 1} +
{r.name}
+
+
+
+
+ {fmt(r.value)} + {r.extra &&
{r.extra}
} +
+
+ ) +} + +function DataTable({ cols, rows, empty }: { cols: string[]; rows: ReactNode[][]; empty: string }) { + if (rows.length === 0) return + return ( +
+ + + + {cols.map((c, i) => )} + + + + {rows.map((r, ri) => ( + + {r.map((cell, ci) => ( + + ))} + + ))} + +
{c}
{cell}
+
+ ) +} + +const named = (rows: Array<{ name: string; amount: number }>) => rows.map(r => ({ name: r.name, value: r.amount })) + +/** Top (n-1) slices plus an "Other" slice, so donuts stay readable. */ +function topWithOther(rows: Array<{ name: string; value: number }>, n = 5) { + const sorted = [...rows].filter(r => r.value > 0).sort((a, b) => b.value - a.value) + if (sorted.length <= n) return sorted + const head = sorted.slice(0, n - 1) + return [...head, { name: 'Other', value: sorted.slice(n - 1).reduce((t, r) => t + r.value, 0) }] +} + +const sharePct = (v: number, total: number) => (total > 0 ? `${((v / total) * 100).toFixed(1)}%` : '—') + +export function SalesSection({ range }: { range: DateRange }) { + const { data: sales, loading } = useLoad( + () => dashboardReports.sales(range), [range.from, range.to], 'Failed to load sales analytics') + const { data: products } = useLoad( + () => productReports.sales({ ...range, pageSize: 10 }).then(r => getPaginatedItems(r)), + [range.from, range.to], 'Failed to load product sales') + + if (loading || !sales) return + + const { current: c, previous: p } = sales.kpis + const kpi = (title: string, key: keyof SalesKpis, money = true) => ( + } + /> + ) + + const trend = sales.trend.map(t => ({ period: t.period, sales: t.sales, returns: t.returns })) + const regionTotal = sales.byRegion.reduce((t, r) => t + r.amount, 0) + const repTotal = sales.byRep.reduce((t, r) => t + r.amount, 0) + + return ( +
+
+ {kpi('Net Sales', 'netSales')} + {kpi('Gross Sales', 'grossSales')} + {kpi('Total Orders', 'orders', false)} + {kpi('Average Order Value', 'averageOrderValue')} + + {c.grossProfitMarginPercent === null ? 'Margin n/a (no cost prices)' : `${c.grossProfitMarginPercent}% margin`} + + } + /> + {kpi('Sales Returns', 'returnValue')} +
+

+ Sales = fulfilled lines on non-cancelled orders with a finalized invoice, dated by finalization. Net = gross − customer returns. + Gross profit uses item cost prices and covers only items that have one. Discounts and sales targets are not tracked per order yet. +

+ +
+ + + + + + + + + [ + r.name, + fmtNum(r.qtyFulfilled), + fmtMoney(r.salesValue), + r.marginPercent === null ? '—' : ( + = 0 ? 'text-emerald-600 dark:text-emerald-400' : 'text-destructive'}>{r.marginPercent}% + ), + ])} + /> + + + ({ name: r.name, value: r.amount, extra: sharePct(r.amount, regionTotal) }))} fmt={fmtMoney} empty="No sales in this period." /> + + + + + + + ({ name: r.name, value: r.amount, extra: sharePct(r.amount, repTotal) }))} fmt={fmtMoney} empty="No sales in this period." /> + +
+
+ ) +} + +export function InventorySection({ range }: { range: DateRange }) { + const { data: inv, loading } = useLoad( + () => dashboardReports.inventory(range), [range.from, range.to], 'Failed to load inventory analytics') + const { data: overview } = useLoad( + () => stockReports.overview(), [], 'Failed to load stock overview') + const { data: lowStock } = useLoad( + () => productReports.stock({ lowStockOnly: true, pageSize: 50 }).then(r => getPaginatedItems(r)), + [], 'Failed to load low-stock products') + const { data: movers } = useLoad( + () => productReports.sales({ ...range, pageSize: 50 }).then(r => getPaginatedItems(r)), + [range.from, range.to], 'Failed to load product sales') + + if (loading || !inv || !overview) return + + const healthy = Math.max(0, overview.totalSkus - overview.lowStockCount - overview.outOfStockCount) + const sold = (movers ?? []).map(r => ({ name: r.name, value: r.qtyFulfilled })) + const fast = sold.slice(0, 3) + const slow = sold.slice(-3).reverse() + const catTotal = inv.valueByCategory.reduce((t, r) => t + r.value, 0) + const lowRows = (lowStock ?? []) + .filter(r => r.reorderLevel) + .sort((a, b) => a.warehouseQty / (a.reorderLevel ?? 1) - b.warehouseQty / (b.reorderLevel ?? 1)) + .slice(0, 10) + + return ( +
+
+ + + At cost price} /> + + + Batches · {fmtNum(overview.expiredCount)} already expired} /> +
+

+ Reserved stock, excess stock, ageing, discrepancies and pending transfers are not tracked yet, so they are not shown. +

+ +
+ + + + + + + + + [r.name, fmtNum(r.quantity), fmtMoney(r.value)])} + /> + + + ({ name: r.category, value: r.value, extra: sharePct(r.value, catTotal) }))} + fmt={fmtMoney} empty="No stock recorded." + /> + + + + { + const cov = Math.round((r.warehouseQty / (r.reorderLevel ?? 1)) * 100) + return [ + r.name, + fmtNum(r.warehouseQty), + fmtNum(r.reorderLevel ?? 0), + {cov}%, + ] + })} + /> + + +
+
Fast-moving
+ +
Slow-moving
+ +
+
+
+
+ ) +} diff --git a/distribution_fe/app/(dashboard)/_components/dashboard-charts.tsx b/distribution_fe/app/(dashboard)/_components/dashboard-charts.tsx index 9b1b3ed..cdd72cf 100644 --- a/distribution_fe/app/(dashboard)/_components/dashboard-charts.tsx +++ b/distribution_fe/app/(dashboard)/_components/dashboard-charts.tsx @@ -1,6 +1,6 @@ 'use client' -import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Label, PolarAngleAxis, Pie, PieChart, RadialBar, RadialBarChart, XAxis, YAxis } from 'recharts' +import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Label, Line, LineChart, PolarAngleAxis, Pie, PieChart, RadialBar, RadialBarChart, XAxis, YAxis } from 'recharts' import { ChartContainer, @@ -60,10 +60,10 @@ export function DonutChart({ data, centerLabel, emptyText }: { data: ChartDatum[ ) } -export function HorizontalBarChart({ data, emptyText, color = 'var(--chart-2)' }: { data: ChartDatum[]; emptyText: string; color?: string }) { +export function HorizontalBarChart({ data, emptyText, color = 'var(--chart-2)', label = 'Quantity' }: { data: ChartDatum[]; emptyText: string; color?: string; label?: string }) { if (data.length === 0 || data.every(d => d.value === 0)) return - const config = { value: { label: 'Quantity', color } } satisfies ChartConfig + const config = { value: { label, color } } satisfies ChartConfig return ( @@ -140,3 +140,83 @@ export function RadialGauge({ pct, label, sub }: { pct: number; label: string; s ) } + +export interface SeriesDef { + key: string + label: string + color: string +} + +const SERIES_COLORS = ['var(--chart-2)', 'var(--chart-4)', 'var(--chart-1)'] +export const seriesColor = (i: number) => SERIES_COLORS[i % SERIES_COLORS.length] + +/** Multi-series line chart over a categorical x axis (day or month labels). */ +export function MultiLineChart({ data, series, emptyText }: { data: Array>; series: SeriesDef[]; emptyText: string }) { + if (data.length === 0) return + const config = Object.fromEntries(series.map(s => [s.key, { label: s.label, color: s.color }])) as ChartConfig + + return ( + + + + + + } /> + {series.map(s => ( + + ))} + } /> + + + ) +} + +/** Grouped (side-by-side) column chart comparing several series per category. */ +export function GroupedColumnChart({ data, series, emptyText }: { data: Array>; series: SeriesDef[]; emptyText: string }) { + if (data.length === 0) return + const config = Object.fromEntries(series.map(s => [s.key, { label: s.label, color: s.color }])) as ChartConfig + + return ( + + + + + + } /> + {series.map(s => ( + + ))} + } /> + + + ) +} + +/** Multi-series smooth area chart with a soft gradient under each line. */ +export function MultiAreaChart({ data, series, emptyText }: { data: Array>; series: SeriesDef[]; emptyText: string }) { + if (data.length === 0) return + const config = Object.fromEntries(series.map(s => [s.key, { label: s.label, color: s.color }])) as ChartConfig + + return ( + + + + {series.map(s => ( + + + + + ))} + + + + + } /> + {series.map(s => ( + + ))} + } /> + + + ) +} diff --git a/distribution_fe/app/(dashboard)/_components/dashboard-client.tsx b/distribution_fe/app/(dashboard)/_components/dashboard-client.tsx index db253d8..a8e2745 100644 --- a/distribution_fe/app/(dashboard)/_components/dashboard-client.tsx +++ b/distribution_fe/app/(dashboard)/_components/dashboard-client.tsx @@ -1,14 +1,10 @@ 'use client' import { useCallback, useEffect, useMemo, useState } from 'react' -import { HugeiconsIcon } from '@hugeicons/react' -import { Add01Icon, Cancel01Icon } from '@hugeicons/core-free-icons' import { ResponsiveGridLayout, DEFAULT_BREAKPOINTS, DEFAULT_COLS, useContainerWidth } from 'react-grid-layout' -import type { Layout, LayoutItem } from 'react-grid-layout' +import type { LayoutItem } from 'react-grid-layout' import 'react-grid-layout/css/styles.css' -import { Button } from '@/components/ui/button' -import { Checkbox } from '@/components/ui/checkbox' import { Skeleton } from '@/components/ui/skeleton' import { toast } from '@/components/ui/toast' import { @@ -23,12 +19,12 @@ import { } from '@/lib/api/index' import { useAuth } from '@/contexts/auth-context' import type { LowStockItemResponse, StockMovementResponse } from '@/types/api' +import { InventorySection, SalesSection, type DateRange } from './analytics-sections' import { ColumnBarChart, DonutChart, HorizontalBarChart, RadialGauge, SalesTrendChart } from './dashboard-charts' import type { ChartDatum, MonthlySalesPoint } from './dashboard-charts' -const STORAGE_KEY = 'distribution-dashboard-widgets-v3' -const ROW_HEIGHT = 36 -const GRID_MARGIN: [number, number] = [16, 16] +const ROW_HEIGHT = 26 +const GRID_MARGIN: [number, number] = [10, 10] type Breakpoint = keyof typeof DEFAULT_BREAKPOINTS const BREAKPOINT_ORDER = Object.keys(DEFAULT_BREAKPOINTS) as Breakpoint[] @@ -83,14 +79,14 @@ const SIZE_CONFIG: Record { - return Object.fromEntries(BREAKPOINT_ORDER.map(bp => [bp, generateFlowLayout(ids, bp)])) as Record -} - -/** Places a newly-added widget below everything else on a given breakpoint, so it never overlaps what's already there. */ -function appendWidget(layout: LayoutItem[], meta: WidgetMeta, bp: Breakpoint): LayoutItem[] { - const cfg = SIZE_CONFIG[bp][meta.size] - const y = layout.reduce((max, item) => Math.max(max, item.y + item.h), 0) - return [...layout, { i: meta.id, x: 0, y, w: cfg.w, h: cfg.h, minW: cfg.minW, minH: cfg.minH }] -} - -interface DashboardLayoutState { - activeIds: string[] - layouts: Record -} - -function defaultLayoutState(): DashboardLayoutState { - return { activeIds: [...DEFAULT_ACTIVE], layouts: generateFlowLayouts(DEFAULT_ACTIVE) } -} - -function loadStoredLayoutState(): DashboardLayoutState { - try { - const raw = window.localStorage.getItem(STORAGE_KEY) - if (!raw) return defaultLayoutState() - - const parsed = JSON.parse(raw) - const validIds = new Set(WIDGET_META.map(w => w.id)) - const activeIds: string[] = Array.isArray(parsed?.activeIds) - ? parsed.activeIds.filter((id: unknown): id is string => typeof id === 'string' && validIds.has(id)) - : [] - if (activeIds.length === 0) return defaultLayoutState() - - const layouts = {} as Record - for (const bp of BREAKPOINT_ORDER) { - const storedLayout: LayoutItem[] = Array.isArray(parsed?.layouts?.[bp]) - ? parsed.layouts[bp].filter((l: unknown): l is LayoutItem => - !!l && typeof l === 'object' && typeof (l as LayoutItem).i === 'string' && validIds.has((l as LayoutItem).i) && activeIds.includes((l as LayoutItem).i)) - : [] - const missingIds = activeIds.filter(id => !storedLayout.some(l => l.i === id)) - layouts[bp] = missingIds.length > 0 ? [...storedLayout, ...generateFlowLayout(missingIds, bp)] : storedLayout - } - - return { activeIds, layouts } - } catch { - return defaultLayoutState() - } -} - const fmtMoney = (v: number) => `Rs. ${v.toLocaleString('en-LK', { minimumFractionDigits: 2 })}` interface OpenRide { @@ -351,12 +299,51 @@ async function loadDashboardData(activeIds: Set): Promise return data } -function CategoryPill({ cat }: { cat: Category }) { - const meta = CATEGORY_META[cat] +const STAT_IDS = ['pendingPO', 'awaitingConfirm', 'fulfillRate', 'deliveryTasks', 'outstandingPay', 'invoiceStatus'] + +function StatTile({ title, value, sub, children }: { title: string; value: string; sub?: string; children?: React.ReactNode }) { return ( - - {meta.label} - +
+
+
{title}
+
{value}
+
+
+ {sub &&
{sub}
} + {children} +
+
+ ) +} + +function StatStrip({ ids, data }: { ids: string[]; data: DashboardData }) { + const pct = data.totalPOCount > 0 ? Math.round((data.fulfilledPOCount / data.totalPOCount) * 100) : 0 + const invTotal = data.draftInvoiceCount + data.printedInvoiceCount + data.finalizedInvoiceCount + const seg = (n: number) => (invTotal > 0 ? `${(n / invTotal) * 100}%` : '0%') + const tiles: Record = { + pendingPO: , + awaitingConfirm: , + fulfillRate: ( + +
+ + ), + deliveryTasks: , + outstandingPay: , + invoiceStatus: ( + +
+
+
+
+
+ + ), + } + return ( +
+ {STAT_IDS.filter(id => ids.includes(id)).map(id =>
{tiles[id]}
)} +
) } @@ -365,14 +352,14 @@ function WidgetBody({ id, data }: { id: string; data: DashboardData }) { case 'pendingPO': return (
-
{data.pendingPOCount}
+
{data.pendingPOCount}
{data.totalPOCount} total orders
) case 'awaitingConfirm': return (
-
{data.awaitingConfirmCount}
+
{data.awaitingConfirmCount}
Confirmed, not yet loaded
) @@ -391,7 +378,7 @@ function WidgetBody({ id, data }: { id: string; data: DashboardData }) {
{r.vehicleNumberPlate}
{r.driverFullName}
- Open + Open
))}
@@ -409,7 +396,7 @@ function WidgetBody({ id, data }: { id: string; data: DashboardData }) { case 'deliveryTasks': return (
-
{data.pendingTasksCount}
+
{data.pendingTasksCount}
{data.partialTasksCount} partially delivered
) @@ -454,7 +441,7 @@ function WidgetBody({ id, data }: { id: string; data: DashboardData }) { case 'outstandingPay': return (
-
{fmtMoney(data.outstandingAmount)}
+
{fmtMoney(data.outstandingAmount)}
{data.outstandingInvoiceCount} invoices
) @@ -496,30 +483,43 @@ function WidgetBody({ id, data }: { id: string; data: DashboardData }) { } } -function mergeLayoutsChange( - full: Record, - changed: Partial>, -): Record { - const next = { ...full } - for (const bp of BREAKPOINT_ORDER) { - const changedArr = changed[bp] - if (!changedArr) continue - next[bp] = full[bp].map(item => { - const updated = changedArr.find(c => c.i === item.i) - return updated ? { ...item, x: updated.x, y: updated.y, w: updated.w, h: updated.h } : item - }) - } - return next +function toIsoDate(d: Date) { + const pad = (n: number) => String(n).padStart(2, '0') + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` +} + +type RangePreset = '7d' | '1m' | '3m' | '1y' | 'custom' + +const RANGE_PRESETS: Array<{ key: RangePreset; label: string }> = [ + { key: '7d', label: 'Last 7 days' }, + { key: '1m', label: '1 month' }, + { key: '3m', label: '3 months' }, + { key: '1y', label: '1 year' }, + { key: 'custom', label: 'Custom' }, +] + +function presetRange(preset: Exclude): DateRange { + const to = new Date() + const from = new Date() + if (preset === '7d') from.setDate(from.getDate() - 6) + else if (preset === '1m') from.setMonth(from.getMonth() - 1) + else if (preset === '3m') from.setMonth(from.getMonth() - 3) + else { from.setFullYear(from.getFullYear() - 1); from.setDate(from.getDate() + 1) } + return { from: toIsoDate(from), to: toIsoDate(to) } +} + +function minFromDate(to: string) { + const d = new Date(`${to}T00:00:00`) + d.setDate(d.getDate() - 365) + return toIsoDate(d) } export function DashboardClient() { const { hasPermission } = useAuth() const [data, setData] = useState(null) const [loading, setLoading] = useState(true) - const [state, setState] = useState(defaultLayoutState) - const [editMode, setEditMode] = useState(false) - const [showPicker, setShowPicker] = useState(false) - const [category, setCategory] = useState<'all' | Category>('all') + const [range, setRange] = useState(() => presetRange('1m')) + const [preset, setPreset] = useState('1m') const { width, containerRef, mounted } = useContainerWidth({ initialWidth: 1200 }) const allowedIds = useMemo( @@ -528,23 +528,10 @@ export function DashboardClient() { ) const permittedActiveIds = useMemo( - () => state.activeIds.filter(id => allowedIds.has(id)), - [state.activeIds, allowedIds], + () => DEFAULT_ACTIVE.filter(id => allowedIds.has(id)), + [allowedIds], ) - useEffect(() => { - setState(loadStoredLayoutState()) - }, []) - - const persist = useCallback((next: DashboardLayoutState) => { - setState(next) - try { - window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next)) - } catch { - // localStorage unavailable (private browsing, etc.) — layout just won't persist - } - }, []) - const fetchData = useCallback(async () => { setLoading(true) try { @@ -560,118 +547,82 @@ export function DashboardClient() { fetchData() }, [fetchData]) - function toggleWidget(id: string, checked: boolean) { - if (checked) { - const meta = WIDGET_META.find(w => w.id === id) - if (!meta || state.activeIds.includes(id)) return - const layouts = { ...state.layouts } - for (const bp of BREAKPOINT_ORDER) layouts[bp] = appendWidget(layouts[bp], meta, bp) - persist({ activeIds: [...state.activeIds, id], layouts }) - } else { - const layouts = { ...state.layouts } - for (const bp of BREAKPOINT_ORDER) layouts[bp] = layouts[bp].filter(l => l.i !== id) - persist({ activeIds: state.activeIds.filter(x => x !== id), layouts }) - } - } - - function handleLayoutChange(_layout: Layout, changedLayouts: Partial>) { - setState(prev => { - const next = { ...prev, layouts: mergeLayoutsChange(prev.layouts, changedLayouts) } - try { - window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next)) - } catch { - // localStorage unavailable — position just won't persist - } - return next - }) - } - const visibleWidgets = useMemo( () => permittedActiveIds .map(id => WIDGET_META.find(w => w.id === id)) .filter((w): w is WidgetMeta => Boolean(w)) - .filter(w => category === 'all' || w.cat === category), - [permittedActiveIds, category], + .filter(w => !STAT_IDS.includes(w.id)), + [permittedActiveIds], ) const visibleLayouts = useMemo(() => { const visibleIds = new Set(visibleWidgets.map(w => w.id)) return Object.fromEntries( - BREAKPOINT_ORDER.map(bp => [bp, state.layouts[bp].filter(l => visibleIds.has(l.i))]), + BREAKPOINT_ORDER.map(bp => [bp, generateFlowLayout(Array.from(visibleIds), bp)]), ) as Record - }, [state.layouts, visibleWidgets]) + }, [visibleWidgets]) - const filters: Array<{ key: 'all' | Category; label: string }> = [ - { key: 'all', label: 'All widgets' }, - { key: 'sales', label: CATEGORY_META.sales.label }, - { key: 'ops', label: CATEGORY_META.ops.label }, - { key: 'stock', label: CATEGORY_META.stock.label }, - { key: 'finance', label: CATEGORY_META.finance.label }, - ] + const canSales = hasPermission('orders.view') + const canInventory = hasPermission('stock.view') return ( -
+
-

Dashboard

+

Dashboard

- {editMode ? 'Drag to move, drag a corner to resize, or tick which widgets show.' : 'Add, remove, drag and resize widgets to make this view yours.'} + Sales, inventory, shop orders, rides and loading sheets, deliveries, stock alerts, invoices and payments

+
-
- {editMode && ( - - )} - - - {showPicker && ( -
-
- Widgets - -
-
- {WIDGET_META.filter(w => allowedIds.has(w.id)).map(w => { - const checked = state.activeIds.includes(w.id) - return ( - - ) - })} -
+ ))}
- )} + {preset === 'custom' && ( +
+ e.target.value && setRange(r => ({ ...r, from: e.target.value }))} + className="rounded-lg border bg-background px-2 py-1 text-xs" + /> + to + e.target.value && setRange(r => ({ ...r, to: e.target.value }))} + className="rounded-lg border bg-background px-2 py-1 text-xs" + /> +
+ )} +
-
- -
- {filters.map(f => ( - - ))} -
+ )} + {canSales && ( +
+

Sales

+ +
+ )} + {canInventory && ( +
+

Inventory

+ +
+ )} {loading || !data ? (
@@ -679,11 +630,9 @@ export function DashboardClient() { ))}
- ) : visibleWidgets.length === 0 ? ( -
- No widgets on this dashboard yet. Click “Widgets” to add some. -
) : ( + <> +
{mounted && ( {visibleWidgets.map(w => ( -
- {editMode && ( - - )} -
-
{w.title}
-
+
+
+
+ + {w.title} +
+
@@ -723,6 +665,7 @@ export function DashboardClient() { )}
+ )}
) diff --git a/distribution_fe/lib/api/index.ts b/distribution_fe/lib/api/index.ts index 08ff4ca..e38e8ed 100644 --- a/distribution_fe/lib/api/index.ts +++ b/distribution_fe/lib/api/index.ts @@ -8,7 +8,7 @@ export { drivers, compliance } from './drivers' export { purchaseOrders, grn, purchaseReturns } from './procurement' export { rides, loadingSheets, deliveryTasks } from './operations' export { stock } from './stock' -export { productReports } from './reports' +export { productReports, stockReports, dashboardReports } from './reports' export { shopPos, invoices, payments } from './sales' export { saleReturns, claims, supplierClaims } from './returns-claims' export { sysConfig, ITEM_TRACKING_KEYS, GRN_TAX_KEYS, grnTaxSettings, DEFAULT_GRN_TAX_SETTINGS } from './sys-config' diff --git a/distribution_fe/lib/api/reports.ts b/distribution_fe/lib/api/reports.ts index 8d5122e..ce91694 100644 --- a/distribution_fe/lib/api/reports.ts +++ b/distribution_fe/lib/api/reports.ts @@ -159,3 +159,41 @@ export const productReports = { summary: (params?: Pick) => api.get('/reports/products/summary', { params }).then(r => r.data), } + +export interface SalesKpis { + grossSales: number + returnValue: number + netSales: number + orders: number + averageOrderValue: number + grossProfit: number + grossProfitMarginPercent: number | null +} + +export interface DashboardSalesSummary { + from: string + to: string + granularity: 'day' | 'month' + kpis: { current: SalesKpis; previous: SalesKpis; previousFrom: string; previousTo: string } + trend: Array<{ period: string; sales: number; returns: number }> + byCategory: Array<{ id: string | null; name: string; amount: number }> + byRegion: Array<{ id: string | null; name: string; amount: number }> + byRep: Array<{ id: string | null; name: string; amount: number }> +} + +export interface DashboardInventorySummary { + from: string + to: string + granularity: 'day' | 'month' + valueByCategory: Array<{ category: string; quantity: number; value: number }> + byWarehouse: Array<{ warehouseId: string; name: string; quantity: number; value: number }> + movementTrend: Array<{ period: string; received: number; issued: number; net: number }> +} + +export const dashboardReports = { + sales: (params?: { from?: string; to?: string; regionId?: string; categoryId?: string }) => + api.get('/reports/dashboard/sales', { params }).then(r => r.data), + + inventory: (params?: { from?: string; to?: string; warehouseId?: string; categoryId?: string }) => + api.get('/reports/dashboard/inventory', { params }).then(r => r.data), +} -- 2.52.0 From 6b608ad2efc1ef5d38f92fa7cbe0e5a09f5a449d Mon Sep 17 00:00:00 2001 From: DeepnaPooja Date: Mon, 19 Oct 2026 16:39:47 +0530 Subject: [PATCH 3/4] Update permission feature with edit and create role functionality --- .../_components/analytics-sections.tsx | 19 +- .../users/roles/[id]/edit/page.tsx | 54 +++++ .../users/roles/_components/role-form.tsx | 208 +++++++++++++++++ .../users/roles/_components/role-sheet.tsx | 217 ------------------ .../users/roles/_components/roles-client.tsx | 16 +- .../app/(dashboard)/users/roles/new/page.tsx | 32 +++ 6 files changed, 311 insertions(+), 235 deletions(-) create mode 100644 distribution_fe/app/(dashboard)/users/roles/[id]/edit/page.tsx create mode 100644 distribution_fe/app/(dashboard)/users/roles/_components/role-form.tsx delete mode 100644 distribution_fe/app/(dashboard)/users/roles/_components/role-sheet.tsx create mode 100644 distribution_fe/app/(dashboard)/users/roles/new/page.tsx diff --git a/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx b/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx index e3ef94a..34e55d5 100644 --- a/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx +++ b/distribution_fe/app/(dashboard)/_components/analytics-sections.tsx @@ -59,8 +59,15 @@ function Kpi({ title, value, footer }: { title: string; value: string; footer?: function LoadingGrid() { return ( -
- {Array.from({ length: 8 }).map((_, i) => )} +
+
+ {Array.from({ length: 6 }).map((_, i) => )} +
+
+ {Array.from({ length: 6 }).map((_, i) => ( + + ))} +
) } @@ -161,11 +168,11 @@ const sharePct = (v: number, total: number) => (total > 0 ? `${((v / total) * 10 export function SalesSection({ range }: { range: DateRange }) { const { data: sales, loading } = useLoad( () => dashboardReports.sales(range), [range.from, range.to], 'Failed to load sales analytics') - const { data: products } = useLoad( + const { data: products, loading: productsLoading } = useLoad( () => productReports.sales({ ...range, pageSize: 10 }).then(r => getPaginatedItems(r)), [range.from, range.to], 'Failed to load product sales') - if (loading || !sales) return + if (loading || productsLoading || !sales) return const { current: c, previous: p } = sales.kpis const kpi = (title: string, key: keyof SalesKpis, money = true) => ( @@ -252,11 +259,11 @@ export function InventorySection({ range }: { range: DateRange }) { const { data: lowStock } = useLoad( () => productReports.stock({ lowStockOnly: true, pageSize: 50 }).then(r => getPaginatedItems(r)), [], 'Failed to load low-stock products') - const { data: movers } = useLoad( + const { data: movers, loading: moversLoading } = useLoad( () => productReports.sales({ ...range, pageSize: 50 }).then(r => getPaginatedItems(r)), [range.from, range.to], 'Failed to load product sales') - if (loading || !inv || !overview) return + if (loading || moversLoading || !inv || !overview) return const healthy = Math.max(0, overview.totalSkus - overview.lowStockCount - overview.outOfStockCount) const sold = (movers ?? []).map(r => ({ name: r.name, value: r.qtyFulfilled })) diff --git a/distribution_fe/app/(dashboard)/users/roles/[id]/edit/page.tsx b/distribution_fe/app/(dashboard)/users/roles/[id]/edit/page.tsx new file mode 100644 index 0000000..4150709 --- /dev/null +++ b/distribution_fe/app/(dashboard)/users/roles/[id]/edit/page.tsx @@ -0,0 +1,54 @@ +'use client' + +import { useEffect, useState } from 'react' +import { useParams, useRouter } from 'next/navigation' +import { HugeiconsIcon } from '@hugeicons/react' +import { ArrowLeft01Icon } from '@hugeicons/core-free-icons' + +import { Button } from '@/components/ui/button' +import { toast } from '@/components/ui/toast' +import { roles as rolesApi, getApiError } from '@/lib/api/index' +import type { RoleResponse } from '@/types/api' + +import { RoleForm } from '../../_components/role-form' + +export default function EditRolePage() { + const { id } = useParams<{ id: string }>() + const router = useRouter() + const goBack = () => router.push('/users/roles') + + const [role, setRole] = useState(null) + const [loading, setLoading] = useState(true) + + useEffect(() => { + rolesApi.get(id) + .then(setRole) + .catch((err) => toast.add({ title: 'Failed to load role', description: getApiError(err), type: 'error' })) + .finally(() => setLoading(false)) + }, [id]) + + return ( +
+
+ +
+

Edit Role

+

Update role details and permissions.

+
+
+ +
+ {loading && ( +
+ {Array.from({ length: 4 }).map((_, i) => ( +
+ ))} +
+ )} + {!loading && role && } +
+
+ ) +} diff --git a/distribution_fe/app/(dashboard)/users/roles/_components/role-form.tsx b/distribution_fe/app/(dashboard)/users/roles/_components/role-form.tsx new file mode 100644 index 0000000..ab5b38b --- /dev/null +++ b/distribution_fe/app/(dashboard)/users/roles/_components/role-form.tsx @@ -0,0 +1,208 @@ +'use client' + +import { useEffect, useState } from 'react' +import { useForm, zodResolver, z } from '@/lib/form' +import { FormField } from '@/components/shared/form-field' +import { Input } from '@/components/ui/input' +import { Checkbox } from '@/components/ui/checkbox' +import { + Select, SelectContent, SelectItem, SelectTrigger, SelectValue, +} from '@/components/ui/select' +import { Button } from '@/components/ui/button' +import { FieldGroup } from '@/components/ui/field' +import { toast } from '@/components/ui/toast' +import { roles as rolesApi, permissions as permissionsApi, getApiError } from '@/lib/api/index' +import type { RoleResponse, PermissionResponse } from '@/types/api' +import { PERMISSION_CATEGORIES } from '@/config/permissions' + +const ROLE_LEVELS: { value: number; label: string; description: string }[] = [ + { value: 10, label: 'Level 10 — Field Agent', description: 'Front-line sales rep; can place orders and check in to visits' }, + { value: 20, label: 'Level 20 — Supervisor', description: 'Oversees agents; can approve variances and update store credit limits' }, + { value: 30, label: 'Level 30 — Area Manager', description: 'Manages a group of supervisors within an area' }, + { value: 40, label: 'Level 40 — Area Supervisor', description: 'Senior oversight across multiple areas' }, + { value: 50, label: 'Level 50 — Regional Manager', description: 'Controls region targets, budgets and route assignments' }, + { value: 60, label: 'Level 60 — Regional Agency', description: 'Agency-level access across any region; broader scope than Regional Manager' }, + { value: 100, label: 'Level 100 — Super Admin', description: 'Full system access; all permissions granted' }, +] + +const schema = z.object({ + name: z.string().min(1, 'Name is required'), + level: z.string().min(1, 'Level is required'), +}) + +type FormValues = z.infer + +// 'orders.view' -> 'View Orders', 'loading-sheet.manage' -> 'Manage Loading Sheet' +function permissionLabel(code: string): string { + const [resource, action] = code.split('.') + const title = (s: string) => s.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(' ') + return action ? `${title(action)} ${title(resource)}` : title(resource) +} + +interface RoleFormProps { + role: RoleResponse | null + onSuccess: () => void + onCancel: () => void + wide?: boolean +} + +export function RoleForm({ role, onSuccess, onCancel, wide = false }: RoleFormProps) { + const isEdit = !!role + + const [allPermissions, setAllPermissions] = useState([]) + const [selectedIds, setSelectedIds] = useState>(new Set()) + + const form = useForm({ + resolver: zodResolver(schema), + defaultValues: { name: '', level: '' }, + }) + + useEffect(() => { + permissionsApi.list().then(setAllPermissions).catch(() => {}) + if (role) { + form.reset({ name: role.name, level: String(role.level) }) + rolesApi.getPermissions(role.id) + .then((perms) => setSelectedIds(new Set(perms.map((p) => p.permissionId)))) + .catch(() => {}) + } else { + form.reset({ name: '', level: '' }) + setSelectedIds(new Set()) + } + }, [role]) + + function togglePermission(id: string) { + setSelectedIds((prev) => { + const next = new Set(prev) + next.has(id) ? next.delete(id) : next.add(id) + return next + }) + } + + async function onSubmit(values: FormValues) { + const body = { name: values.name, level: parseInt(values.level, 10) } + try { + let roleId: string + if (isEdit) { + await rolesApi.update(role!.id, body) + roleId = role!.id + toast.add({ title: 'Role updated', type: 'success' }) + } else { + const created = await rolesApi.create(body) + roleId = created.id + toast.add({ title: 'Role created', type: 'success' }) + } + await rolesApi.assignPermissions(roleId, Array.from(selectedIds)) + onSuccess() + } catch (err) { + toast.add({ title: 'Failed to save role', description: getApiError(err), type: 'error' }) + } + } + + return ( +
+ + ( + + )} + /> + ( + + )} + /> + + + {allPermissions.length > 0 && ( +
+

Permissions

+
+
+ {PERMISSION_CATEGORIES.map((cat) => { + const catPerms = allPermissions.filter((p) => cat.codes.includes(p.code)) + if (catPerms.length === 0) return null + const allChecked = catPerms.every((p) => selectedIds.has(p.permissionId)) + const someChecked = catPerms.some((p) => selectedIds.has(p.permissionId)) + return ( +
+
+ { + setSelectedIds((prev) => { + const next = new Set(prev) + catPerms.forEach((p) => checked ? next.add(p.permissionId) : next.delete(p.permissionId)) + return next + }) + }} + /> + +
+
+ {catPerms.map((p) => ( +
+ togglePermission(p.permissionId)} + className="mt-0.5" + /> + +
+ ))} +
+
+ ) + })} +
+
+
+ )} + +
+ + +
+
+ ) +} diff --git a/distribution_fe/app/(dashboard)/users/roles/_components/role-sheet.tsx b/distribution_fe/app/(dashboard)/users/roles/_components/role-sheet.tsx deleted file mode 100644 index ed51e61..0000000 --- a/distribution_fe/app/(dashboard)/users/roles/_components/role-sheet.tsx +++ /dev/null @@ -1,217 +0,0 @@ -'use client' - -import { useEffect, useState } from 'react' -import { useForm, zodResolver, z } from '@/lib/form' -import { FormField } from '@/components/shared/form-field' -import { Input } from '@/components/ui/input' -import { Checkbox } from '@/components/ui/checkbox' -import { - Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from '@/components/ui/select' -import { Button } from '@/components/ui/button' -import { - Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, -} from '@/components/ui/dialog' -import { FieldGroup } from '@/components/ui/field' -import { toast } from '@/components/ui/toast' -import { roles as rolesApi, permissions as permissionsApi, getApiError } from '@/lib/api/index' -import type { RoleResponse, PermissionResponse } from '@/types/api' -import { PERMISSION_CATEGORIES } from '@/config/permissions' - -const ROLE_LEVELS: { value: number; label: string; description: string }[] = [ - { value: 10, label: 'Level 10 — Field Agent', description: 'Front-line sales rep; can place orders and check in to visits' }, - { value: 20, label: 'Level 20 — Supervisor', description: 'Oversees agents; can approve variances and update store credit limits' }, - { value: 30, label: 'Level 30 — Area Manager', description: 'Manages a group of supervisors within an area' }, - { value: 40, label: 'Level 40 — Area Supervisor', description: 'Senior oversight across multiple areas' }, - { value: 50, label: 'Level 50 — Regional Manager', description: 'Controls region targets, budgets and route assignments' }, - { value: 60, label: 'Level 60 — Regional Agency', description: 'Agency-level access across any region; broader scope than Regional Manager' }, - { value: 100, label: 'Level 100 — Super Admin', description: 'Full system access; all permissions granted' }, -] - -const schema = z.object({ - name: z.string().min(1, 'Name is required'), - level: z.string().min(1, 'Level is required'), -}) - -type FormValues = z.infer - -interface RoleSheetProps { - open: boolean - onClose: () => void - role: RoleResponse | null - onSuccess: () => void -} - -export function RoleSheet({ open, onClose, role, onSuccess }: RoleSheetProps) { - const isEdit = !!role - - const [allPermissions, setAllPermissions] = useState([]) - const [selectedIds, setSelectedIds] = useState>(new Set()) - - const form = useForm({ - resolver: zodResolver(schema), - defaultValues: { name: '', level: '' }, - }) - - useEffect(() => { - if (!open) return - permissionsApi.list().then(setAllPermissions).catch(() => {}) - if (role) { - form.reset({ name: role.name, level: String(role.level) }) - rolesApi.getPermissions(role.id) - .then((perms) => setSelectedIds(new Set(perms.map((p) => p.permissionId)))) - .catch(() => {}) - } else { - form.reset({ name: '', level: '' }) - setSelectedIds(new Set()) - } - }, [open, role]) - - function togglePermission(id: string) { - setSelectedIds((prev) => { - const next = new Set(prev) - next.has(id) ? next.delete(id) : next.add(id) - return next - }) - } - - async function onSubmit(values: FormValues) { - const body = { name: values.name, level: parseInt(values.level, 10) } - try { - let roleId: string - if (isEdit) { - await rolesApi.update(role!.id, body) - roleId = role!.id - toast.add({ title: 'Role updated', type: 'success' }) - } else { - const created = await rolesApi.create(body) - roleId = created.id - toast.add({ title: 'Role created', type: 'success' }) - } - await rolesApi.assignPermissions(roleId, Array.from(selectedIds)) - onSuccess() - onClose() - } catch (err) { - toast.add({ title: 'Failed to save role', description: getApiError(err), type: 'error' }) - } - } - - return ( - !v && onClose()}> - - - {isEdit ? 'Edit Role' : 'Add Role'} - - {isEdit ? 'Update role details and permissions.' : 'Create a new role and assign permissions.'} - - - -
- - ( - - )} - /> - ( - - )} - /> - - - {allPermissions.length > 0 && ( -
-

Permissions

-
-
- {PERMISSION_CATEGORIES.map((cat) => { - const catPerms = allPermissions.filter((p) => cat.codes.includes(p.code)) - if (catPerms.length === 0) return null - const allChecked = catPerms.every((p) => selectedIds.has(p.permissionId)) - const someChecked = catPerms.some((p) => selectedIds.has(p.permissionId)) - return ( -
-
- { - setSelectedIds((prev) => { - const next = new Set(prev) - catPerms.forEach((p) => checked ? next.add(p.permissionId) : next.delete(p.permissionId)) - return next - }) - }} - /> - -
-
- {catPerms.map((p) => ( -
- togglePermission(p.permissionId)} - className="mt-0.5" - /> - -
- ))} -
-
- ) - })} -
-
-
- )} - - - - - -
-
-
- ) -} diff --git a/distribution_fe/app/(dashboard)/users/roles/_components/roles-client.tsx b/distribution_fe/app/(dashboard)/users/roles/_components/roles-client.tsx index 108cd7d..f757c5e 100644 --- a/distribution_fe/app/(dashboard)/users/roles/_components/roles-client.tsx +++ b/distribution_fe/app/(dashboard)/users/roles/_components/roles-client.tsx @@ -1,6 +1,7 @@ 'use client' import { useState, useEffect, useCallback, useMemo } from 'react' +import { useRouter } from 'next/navigation' import { HugeiconsIcon } from '@hugeicons/react' import { Add01Icon } from '@hugeicons/core-free-icons' @@ -12,17 +13,15 @@ import { toast } from '@/components/ui/toast' import { roles as rolesApi, getApiError } from '@/lib/api/index' import type { RoleResponse } from '@/types/api' -import { RoleSheet } from './role-sheet' import { RoleViewSheet } from './role-view-sheet' export function RolesClient() { + const router = useRouter() const [data, setData] = useState([]) const [loading, setLoading] = useState(true) const [total, setTotal] = useState(0) const [pageSize, setPageSize] = useState(20) - const [sheetOpen, setSheetOpen] = useState(false) - const [editing, setEditing] = useState(null) const [viewOpen, setViewOpen] = useState(false) const [viewing, setViewing] = useState(null) @@ -41,8 +40,8 @@ export function RolesClient() { useEffect(() => { fetchData() }, [fetchData]) - function openCreate() { setEditing(null); setSheetOpen(true) } - function openEdit(role: RoleResponse) { setEditing(role); setSheetOpen(true) } + function openCreate() { router.push('/users/roles/new') } + function openEdit(role: RoleResponse) { router.push(`/users/roles/${role.id}/edit`) } function openView(role: RoleResponse) { setViewing(role); setViewOpen(true) } async function handleDeactivate(role: RoleResponse) { @@ -122,13 +121,6 @@ export function RolesClient() { onServerSideChange={({ page: p }) => setPageSize(p.pageSize)} /> - setSheetOpen(false)} - role={editing} - onSuccess={() => fetchData()} - /> - setViewOpen(false)} diff --git a/distribution_fe/app/(dashboard)/users/roles/new/page.tsx b/distribution_fe/app/(dashboard)/users/roles/new/page.tsx new file mode 100644 index 0000000..87e0fb6 --- /dev/null +++ b/distribution_fe/app/(dashboard)/users/roles/new/page.tsx @@ -0,0 +1,32 @@ +'use client' + +import { useRouter } from 'next/navigation' +import { HugeiconsIcon } from '@hugeicons/react' +import { ArrowLeft01Icon } from '@hugeicons/core-free-icons' + +import { Button } from '@/components/ui/button' + +import { RoleForm } from '../_components/role-form' + +export default function NewRolePage() { + const router = useRouter() + const goBack = () => router.push('/users/roles') + + return ( +
+
+ +
+

Add Role

+

Create a new role and assign permissions.

+
+
+ +
+ +
+
+ ) +} -- 2.52.0 From 94db2a311c5a3888d7e109be5993a03263889dab Mon Sep 17 00:00:00 2001 From: "Kalana B. Thilakarathna" Date: Mon, 19 Oct 2026 16:42:12 +0530 Subject: [PATCH 4/4] Refactor code structure for improved readability and maintainability --- Distribution/Data/AppDBContext.cs | 12 + ...9111029_SeedDefaultCashAccount.Designer.cs | 5559 +++++++++++++++++ .../20261019111029_SeedDefaultCashAccount.cs | 729 +++ .../Migrations/AppDBContextModelSnapshot.cs | 113 +- 4 files changed, 6363 insertions(+), 50 deletions(-) create mode 100644 Distribution/Migrations/20261019111029_SeedDefaultCashAccount.Designer.cs create mode 100644 Distribution/Migrations/20261019111029_SeedDefaultCashAccount.cs diff --git a/Distribution/Data/AppDBContext.cs b/Distribution/Data/AppDBContext.cs index 4c20ce0..7dd0827 100644 --- a/Distribution/Data/AppDBContext.cs +++ b/Distribution/Data/AppDBContext.cs @@ -614,6 +614,18 @@ public class AppDBContext(DbContextOptions options) : DbContext(op .HasIndex(a => new { a.AccountType, a.AccountName }) .IsUnique(); + modelBuilder.Entity().HasData(new BankAccount + { + Id = new Guid("11111111-1111-1111-1111-000000000001"), + CreatedAt = new DateTime(2026, 10, 19), + IsActive = true, + AccountType = BankAccountType.Cash, + AccountName = "Petty Cash", + CashAccountTypeName = "Petty Cash", + CurrencyCode = "LKR", + IsDefault = true + }); + modelBuilder.Entity() .Property(b => b.ChequeBookNo).HasMaxLength(100); modelBuilder.Entity() diff --git a/Distribution/Migrations/20261019111029_SeedDefaultCashAccount.Designer.cs b/Distribution/Migrations/20261019111029_SeedDefaultCashAccount.Designer.cs new file mode 100644 index 0000000..6a27e55 --- /dev/null +++ b/Distribution/Migrations/20261019111029_SeedDefaultCashAccount.Designer.cs @@ -0,0 +1,5559 @@ +// +using System; +using Distribution.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Distribution.Migrations +{ + [DbContext(typeof(AppDBContext))] + [Migration("20261019111029_SeedDefaultCashAccount")] + partial class SeedDefaultCashAccount + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Distribution.Models.BankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AccountName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("AccountNumber") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("AccountType") + .HasColumnType("int"); + + b.Property("BankName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("CashAccountTypeName") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrencyCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("AccountType", "AccountName") + .IsUnique(); + + b.ToTable("BankAccounts"); + + b.HasData( + new + { + Id = new Guid("11111111-1111-1111-1111-000000000001"), + AccountName = "Petty Cash", + AccountType = 0, + CashAccountTypeName = "Petty Cash", + CreatedAt = new DateTime(2026, 10, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), + CurrencyCode = "LKR", + IsActive = true, + IsDefault = true + }); + }); + + modelBuilder.Entity("Distribution.Models.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExternalErpId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Brands"); + + b.HasData( + new + { + Id = new Guid("21000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Coca-Cola" + }, + new + { + Id = new Guid("21000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Lays" + }); + }); + + modelBuilder.Entity("Distribution.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowCustomerReturn") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExternalErpId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + + b.HasData( + new + { + Id = new Guid("20000000-0000-0000-0000-000000000001"), + AllowCustomerReturn = false, + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Beverages" + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000002"), + AllowCustomerReturn = false, + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Snacks" + }); + }); + + modelBuilder.Entity("Distribution.Models.ChequeBook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BranchId") + .HasColumnType("int"); + + b.Property("ChequeBookNo") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedBy") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("EndChequeNo") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("FK_BankAccountId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ReceivedDate") + .HasColumnType("datetime(6)"); + + b.Property("StartChequeNo") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalLeaves") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ChequeBookNo") + .IsUnique(); + + b.HasIndex("FK_BankAccountId"); + + b.ToTable("ChequeBooks"); + }); + + modelBuilder.Entity("Distribution.Models.ChequePage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Amount") + .HasColumnType("decimal(65,30)"); + + b.Property("CancelReason") + .HasColumnType("longtext"); + + b.Property("ChequeNo") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ClearedByBank") + .HasColumnType("tinyint(1)"); + + b.Property("ClearedDate") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrencyCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("FK_ChequeBookId") + .HasColumnType("char(36)"); + + b.Property("IsAccountPayee") + .HasColumnType("tinyint(1)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsCrossCheque") + .HasColumnType("tinyint(1)"); + + b.Property("IsPostDated") + .HasColumnType("tinyint(1)"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)"); + + b.Property("IssueStatus") + .HasColumnType("int"); + + b.Property("Notes") + .HasColumnType("longtext"); + + b.Property("PayeeId") + .HasColumnType("int"); + + b.Property("PayeeName") + .HasColumnType("longtext"); + + b.Property("PayeeType") + .HasColumnType("int"); + + b.Property("PrintedAt") + .HasColumnType("datetime(6)"); + + b.Property("PrintedBy") + .HasColumnType("longtext"); + + b.Property("Purpose") + .HasColumnType("longtext"); + + b.Property("ReferenceNo") + .HasColumnType("longtext"); + + b.Property("VoucherId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ChequeNo") + .IsUnique(); + + b.HasIndex("FK_ChequeBookId"); + + b.ToTable("ChequePages"); + }); + + modelBuilder.Entity("Distribution.Models.Claim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Details") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FK_AgencyUserId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("SettledAt") + .HasColumnType("datetime(6)"); + + b.Property("SettledByUserId") + .HasColumnType("char(36)"); + + b.Property("SettlementAmount") + .HasColumnType("decimal(65,30)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_AgencyUserId"); + + b.HasIndex("SettledByUserId"); + + b.ToTable("Claims"); + + b.HasData( + new + { + Id = new Guid("53000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 27, 0, 0, 0, 0, DateTimeKind.Unspecified), + Details = "Distributor margin claim for Q3 promotional shortfall", + FK_AgencyUserId = new Guid("70000000-0000-0000-0000-000000000001"), + IsActive = true, + SettledAt = new DateTime(2026, 8, 28, 0, 0, 0, 0, DateTimeKind.Unspecified), + SettledByUserId = new Guid("29000000-0000-0000-0000-000000000006"), + SettlementAmount = 15000m, + Status = 1 + }); + }); + + modelBuilder.Entity("Distribution.Models.CreditNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Amount") + .HasColumnType("decimal(65,30)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_SaleReturnId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IssuedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("FK_SaleReturnId"); + + b.ToTable("CreditNotes"); + + b.HasData( + new + { + Id = new Guid("54000000-0000-0000-0000-000000000001"), + Amount = 300m, + CreatedAt = new DateTime(2026, 8, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_SaleReturnId = new Guid("51000000-0000-0000-0000-000000000001"), + IsActive = true, + IssuedAt = new DateTime(2026, 8, 26, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Distribution.Models.DeliveryRun", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CancelReason") + .HasColumnType("longtext"); + + b.Property("CancelTypeCode") + .HasColumnType("int"); + + b.Property("ClosedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_DriverProfileId") + .HasColumnType("char(36)"); + + b.Property("FK_VehicleId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Meterend") + .HasColumnType("int"); + + b.Property("Meterstart") + .HasColumnType("int"); + + b.Property("StartedAt") + .HasColumnType("datetime(6)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_DriverProfileId"); + + b.HasIndex("FK_VehicleId"); + + b.ToTable("DeliveryRuns"); + + b.HasData( + new + { + Id = new Guid("31000000-0000-0000-0000-000000000001"), + ClosedAt = new DateTime(2026, 8, 25, 14, 0, 0, 0, DateTimeKind.Unspecified), + CreatedAt = new DateTime(2026, 8, 25, 7, 30, 0, 0, DateTimeKind.Unspecified), + FK_DriverProfileId = new Guid("30000000-0000-0000-0000-000000000001"), + FK_VehicleId = new Guid("28000000-0000-0000-0000-000000000001"), + IsActive = true, + Meterend = 10550, + Meterstart = 10500, + StartedAt = new DateTime(2026, 8, 25, 8, 0, 0, 0, DateTimeKind.Unspecified), + Status = 2 + }, + new + { + Id = new Guid("31000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 30, 8, 45, 0, 0, DateTimeKind.Unspecified), + FK_DriverProfileId = new Guid("30000000-0000-0000-0000-000000000002"), + FK_VehicleId = new Guid("28000000-0000-0000-0000-000000000002"), + IsActive = true, + Meterend = 0, + Meterstart = 20300, + StartedAt = new DateTime(2026, 8, 30, 9, 0, 0, 0, DateTimeKind.Unspecified), + Status = 0 + }); + }); + + modelBuilder.Entity("Distribution.Models.DeliveryTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConfirmedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CustomerConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("FK_RideId") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .HasColumnType("longtext"); + + b.Property("Sequence") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_RideId"); + + b.HasIndex("FK_ShopPOId"); + + b.ToTable("DeliveryTasks"); + + b.HasData( + new + { + Id = new Guid("37000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 30, 10, 5, 0, 0, DateTimeKind.Unspecified), + CustomerConfirmed = false, + FK_RideId = new Guid("31000000-0000-0000-0000-000000000002"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000002"), + IsActive = true, + Sequence = 1, + Status = 0 + }); + }); + + modelBuilder.Entity("Distribution.Models.DriverComplianceConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EnforceLicenseExpiry") + .HasColumnType("tinyint(1)"); + + b.Property("EnforceMedicalClearance") + .HasColumnType("tinyint(1)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("DriverComplianceConfigs"); + + b.HasData( + new + { + Id = new Guid("64000000-0000-0000-0000-000000000001"), + EnforceLicenseExpiry = true, + EnforceMedicalClearance = true, + UpdatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + UpdatedBy = new Guid("29000000-0000-0000-0000-000000000001") + }); + }); + + modelBuilder.Entity("Distribution.Models.DriverProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_UserId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("LicenseExpiry") + .HasColumnType("datetime(6)"); + + b.Property("LicenseNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MedicalClearanceExpiry") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("FK_UserId") + .IsUnique(); + + b.ToTable("DriverProfiles"); + + b.HasData( + new + { + Id = new Guid("30000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_UserId = new Guid("29000000-0000-0000-0000-000000000004"), + IsActive = true, + LicenseExpiry = new DateTime(2027, 6, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), + LicenseNumber = "B1234567", + MedicalClearanceExpiry = new DateTime(2027, 1, 31, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + Id = new Guid("30000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_UserId = new Guid("29000000-0000-0000-0000-000000000005"), + IsActive = true, + LicenseExpiry = new DateTime(2027, 9, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), + LicenseNumber = "B7654321", + MedicalClearanceExpiry = new DateTime(2027, 3, 31, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceipt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DiscountPercent") + .HasPrecision(5, 2) + .HasColumnType("decimal(5,2)"); + + b.Property("FK_PurchaseOrderId") + .HasColumnType("char(36)"); + + b.Property("FK_ReceivedByUserId") + .HasColumnType("char(36)"); + + b.Property("FK_SupplierId") + .HasColumnType("char(36)"); + + b.Property("FK_WarehouseId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("NbtPercent") + .HasPrecision(5, 2) + .HasColumnType("decimal(5,2)"); + + b.Property("ReceivedAt") + .HasColumnType("datetime(6)"); + + b.Property("VatPercent") + .HasPrecision(5, 2) + .HasColumnType("decimal(5,2)"); + + b.HasKey("Id"); + + b.HasIndex("FK_PurchaseOrderId"); + + b.HasIndex("FK_SupplierId"); + + b.HasIndex("FK_WarehouseId"); + + b.ToTable("GoodsReceipts"); + + b.HasData( + new + { + Id = new Guid("43000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + DiscountPercent = 0m, + FK_PurchaseOrderId = new Guid("41000000-0000-0000-0000-000000000001"), + FK_ReceivedByUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_WarehouseId = new Guid("27000000-0000-0000-0000-000000000001"), + IsActive = true, + NbtPercent = 0m, + ReceivedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + VatPercent = 0m + }); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AcceptedQuantity") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DiscountPercent") + .HasPrecision(5, 2) + .HasColumnType("decimal(5,2)"); + + b.Property("FK_GoodsReceiptId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_PurchaseOrderItemId") + .HasColumnType("char(36)"); + + b.Property("FreeQuantity") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("NbtPercent") + .HasPrecision(5, 2) + .HasColumnType("decimal(5,2)"); + + b.Property("RejectedQuantity") + .HasColumnType("int"); + + b.Property("UnitCost") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("VatPercent") + .HasPrecision(5, 2) + .HasColumnType("decimal(5,2)"); + + b.HasKey("Id"); + + b.HasIndex("FK_GoodsReceiptId"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_PurchaseOrderItemId"); + + b.ToTable("GoodsReceiptItems"); + + b.HasData( + new + { + Id = new Guid("44000000-0000-0000-0000-000000000001"), + AcceptedQuantity = 200, + CreatedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + DiscountPercent = 0m, + FK_GoodsReceiptId = new Guid("43000000-0000-0000-0000-000000000001"), + FK_PurchaseOrderItemId = new Guid("42000000-0000-0000-0000-000000000001"), + FreeQuantity = 0, + IsActive = true, + NbtPercent = 0m, + RejectedQuantity = 0, + UnitCost = 0m, + VatPercent = 0m + }, + new + { + Id = new Guid("44000000-0000-0000-0000-000000000002"), + AcceptedQuantity = 98, + CreatedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + DiscountPercent = 0m, + FK_GoodsReceiptId = new Guid("43000000-0000-0000-0000-000000000001"), + FK_PurchaseOrderItemId = new Guid("42000000-0000-0000-0000-000000000002"), + FreeQuantity = 0, + IsActive = true, + NbtPercent = 0m, + RejectedQuantity = 2, + UnitCost = 0m, + VatPercent = 0m + }); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItemBatch", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_GoodsReceiptItemId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemBatchId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_GoodsReceiptItemId"); + + b.HasIndex("FK_ItemBatchId"); + + b.ToTable("GoodsReceiptItemBatches"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItemSerial", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_GoodsReceiptItemId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemSerialNumberId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("FK_GoodsReceiptItemId"); + + b.HasIndex("FK_ItemSerialNumberId"); + + b.ToTable("GoodsReceiptItemSerials"); + }); + + modelBuilder.Entity("Distribution.Models.Invoice", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedBy") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOId") + .HasColumnType("char(36)"); + + b.Property("FinalizedAt") + .HasColumnType("datetime(6)"); + + b.Property("FinalizedBy") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("PaymentStatus") + .HasColumnType("int"); + + b.Property("PrintedAt") + .HasColumnType("datetime(6)"); + + b.Property("PrintedBy") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalAmount") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ShopPOId"); + + b.ToTable("Invoices"); + + b.HasData( + new + { + Id = new Guid("34500000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 25, 8, 30, 0, 0, DateTimeKind.Unspecified), + CreatedBy = new Guid("29000000-0000-0000-0000-000000000002"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000001"), + FinalizedAt = new DateTime(2026, 8, 25, 9, 0, 0, 0, DateTimeKind.Unspecified), + FinalizedBy = new Guid("29000000-0000-0000-0000-000000000001"), + IsActive = true, + PaymentStatus = 2, + PrintedAt = new DateTime(2026, 8, 25, 8, 45, 0, 0, DateTimeKind.Unspecified), + PrintedBy = new Guid("29000000-0000-0000-0000-000000000002"), + Status = 2, + TotalAmount = 3000m + }, + new + { + Id = new Guid("34500000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 31, 9, 0, 0, 0, DateTimeKind.Unspecified), + CreatedBy = new Guid("29000000-0000-0000-0000-000000000003"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000003"), + IsActive = true, + PaymentStatus = 1, + PrintedAt = new DateTime(2026, 8, 31, 9, 15, 0, 0, DateTimeKind.Unspecified), + PrintedBy = new Guid("29000000-0000-0000-0000-000000000003"), + Status = 1, + TotalAmount = 2400m + }); + }); + + modelBuilder.Entity("Distribution.Models.Item", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowCustomWarrantyPeriod") + .HasColumnType("tinyint(1)"); + + b.Property("CostPrice") + .HasColumnType("decimal(65,30)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ExternalErpItemId") + .HasColumnType("int"); + + b.Property("FK_BaseUomId") + .HasColumnType("char(36)"); + + b.Property("FK_BrandId") + .HasColumnType("char(36)"); + + b.Property("FK_CategoryId") + .HasColumnType("char(36)"); + + b.Property("FK_SubCategoryId") + .HasColumnType("char(36)"); + + b.Property("HasWarranty") + .HasColumnType("tinyint(1)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("LastSyncedAt") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ReorderLevel") + .HasColumnType("decimal(65,30)"); + + b.Property("SalePrice") + .HasColumnType("decimal(65,30)"); + + b.Property("Sku") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SyncSource") + .HasColumnType("int"); + + b.Property("TracksBatches") + .HasColumnType("tinyint(1)"); + + b.Property("TracksExpiryDate") + .HasColumnType("tinyint(1)"); + + b.Property("TracksSerialNumbers") + .HasColumnType("tinyint(1)"); + + b.Property("WarrantyPeriodDays") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_BaseUomId"); + + b.HasIndex("FK_BrandId"); + + b.HasIndex("FK_CategoryId"); + + b.HasIndex("FK_SubCategoryId"); + + b.ToTable("Items"); + + b.HasData( + new + { + Id = new Guid("23000000-0000-0000-0000-000000000001"), + AllowCustomWarrantyPeriod = false, + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Coca-Cola 500ml bottle", + FK_BaseUomId = new Guid("22000000-0000-0000-0000-000000000001"), + FK_BrandId = new Guid("21000000-0000-0000-0000-000000000001"), + FK_CategoryId = new Guid("20000000-0000-0000-0000-000000000001"), + HasWarranty = false, + IsActive = true, + Name = "Coca-Cola 500ml", + SalePrice = 60m, + Sku = "BEV-COKE-500", + SyncSource = 0, + TracksBatches = false, + TracksExpiryDate = false, + TracksSerialNumbers = false + }, + new + { + Id = new Guid("23000000-0000-0000-0000-000000000002"), + AllowCustomWarrantyPeriod = false, + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Coca-Cola 1.5L bottle", + FK_BaseUomId = new Guid("22000000-0000-0000-0000-000000000001"), + FK_BrandId = new Guid("21000000-0000-0000-0000-000000000001"), + FK_CategoryId = new Guid("20000000-0000-0000-0000-000000000001"), + HasWarranty = false, + IsActive = true, + Name = "Coca-Cola 1.5L", + SalePrice = 120m, + Sku = "BEV-COKE-1500", + SyncSource = 0, + TracksBatches = false, + TracksExpiryDate = false, + TracksSerialNumbers = false + }, + new + { + Id = new Guid("23000000-0000-0000-0000-000000000003"), + AllowCustomWarrantyPeriod = false, + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Lays Classic Salted 52g pack", + FK_BaseUomId = new Guid("22000000-0000-0000-0000-000000000001"), + FK_BrandId = new Guid("21000000-0000-0000-0000-000000000002"), + FK_CategoryId = new Guid("20000000-0000-0000-0000-000000000002"), + HasWarranty = false, + IsActive = true, + Name = "Lays Classic 52g", + SalePrice = 50m, + Sku = "SNK-LAYS-52", + SyncSource = 0, + TracksBatches = false, + TracksExpiryDate = false, + TracksSerialNumbers = false + }, + new + { + Id = new Guid("23000000-0000-0000-0000-000000000004"), + AllowCustomWarrantyPeriod = false, + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Lays Family Pack 150g", + FK_BaseUomId = new Guid("22000000-0000-0000-0000-000000000001"), + FK_BrandId = new Guid("21000000-0000-0000-0000-000000000002"), + FK_CategoryId = new Guid("20000000-0000-0000-0000-000000000002"), + HasWarranty = false, + IsActive = true, + Name = "Lays Family Pack 150g", + SalePrice = 150m, + Sku = "SNK-LAYS-FAM", + SyncSource = 0, + TracksBatches = false, + TracksExpiryDate = false, + TracksSerialNumbers = false + }); + }); + + modelBuilder.Entity("Distribution.Models.ItemBatch", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BatchNumber") + .HasColumnType("varchar(255)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ManufactureDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId", "BatchNumber"); + + b.ToTable("ItemBatches"); + }); + + modelBuilder.Entity("Distribution.Models.ItemSerialNumber", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrentLocationId") + .HasColumnType("char(36)"); + + b.Property("CurrentLocationType") + .HasColumnType("int"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ReceivedAt") + .HasColumnType("datetime(6)"); + + b.Property("SerialNumber") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("WarrantyExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("WarrantyPeriodDaysOverride") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId", "SerialNumber") + .IsUnique(); + + b.ToTable("ItemSerialNumbers"); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConfirmedAt") + .HasColumnType("datetime(6)"); + + b.Property("ConfirmedBy") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_RideId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("PopulatedAt") + .HasColumnType("datetime(6)"); + + b.Property("PopulatedBy") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_RideId"); + + b.ToTable("LoadingSheets"); + + b.HasData( + new + { + Id = new Guid("35000000-0000-0000-0000-000000000001"), + ConfirmedAt = new DateTime(2026, 8, 25, 7, 45, 0, 0, DateTimeKind.Unspecified), + ConfirmedBy = new Guid("29000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 25, 7, 30, 0, 0, DateTimeKind.Unspecified), + FK_RideId = new Guid("31000000-0000-0000-0000-000000000001"), + IsActive = true, + PopulatedAt = new DateTime(2026, 8, 25, 7, 30, 0, 0, DateTimeKind.Unspecified), + PopulatedBy = new Guid("29000000-0000-0000-0000-000000000001"), + Status = 1 + }); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheetItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_LoadingSheetId") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOItemId") + .HasColumnType("char(36)"); + + b.Property("FK_WarehouseId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("QuantityDispatched") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_LoadingSheetId"); + + b.HasIndex("FK_ShopPOItemId"); + + b.HasIndex("FK_WarehouseId"); + + b.ToTable("LoadingSheetItems"); + + b.HasData( + new + { + Id = new Guid("36000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 25, 7, 30, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_LoadingSheetId = new Guid("35000000-0000-0000-0000-000000000001"), + FK_WarehouseId = new Guid("27000000-0000-0000-0000-000000000001"), + IsActive = true, + QuantityDispatched = 50m + }, + new + { + Id = new Guid("36000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 25, 7, 30, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + FK_LoadingSheetId = new Guid("35000000-0000-0000-0000-000000000001"), + FK_WarehouseId = new Guid("27000000-0000-0000-0000-000000000001"), + IsActive = true, + QuantityDispatched = 30m + }); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheetOrder", b => + { + b.Property("FK_LoadingSheetId") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOId") + .HasColumnType("char(36)"); + + b.HasKey("FK_LoadingSheetId", "FK_ShopPOId"); + + b.HasIndex("FK_ShopPOId"); + + b.ToTable("LoadingSheetOrders"); + }); + + modelBuilder.Entity("Distribution.Models.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Amount") + .HasColumnType("decimal(65,30)"); + + b.Property("ChequeDate") + .HasColumnType("datetime(6)"); + + b.Property("ChequeNumber") + .HasColumnType("longtext"); + + b.Property("CollectedAt") + .HasColumnType("datetime(6)"); + + b.Property("CollectedBy") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("EntryMode") + .HasColumnType("int"); + + b.Property("FK_InvoiceId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Method") + .HasColumnType("int"); + + b.Property("RecordedBy") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FK_InvoiceId"); + + b.ToTable("Payments"); + + b.HasData( + new + { + Id = new Guid("47000000-0000-0000-0000-000000000001"), + Amount = 3000m, + CollectedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified), + CollectedBy = new Guid("29000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified), + EntryMode = 0, + FK_InvoiceId = new Guid("34500000-0000-0000-0000-000000000001"), + IsActive = true, + Method = 0 + }, + new + { + Id = new Guid("47000000-0000-0000-0000-000000000002"), + Amount = 1000m, + CollectedAt = new DateTime(2026, 8, 31, 9, 20, 0, 0, DateTimeKind.Unspecified), + CollectedBy = new Guid("29000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 31, 9, 20, 0, 0, DateTimeKind.Unspecified), + EntryMode = 0, + FK_InvoiceId = new Guid("34500000-0000-0000-0000-000000000002"), + IsActive = true, + Method = 0 + }, + new + { + Id = new Guid("47000000-0000-0000-0000-000000000003"), + Amount = 800m, + ChequeDate = new DateTime(2026, 8, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), + ChequeNumber = "000456", + CollectedAt = new DateTime(2026, 8, 31, 11, 0, 0, 0, DateTimeKind.Unspecified), + CollectedBy = new Guid("29000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 31, 18, 0, 0, 0, DateTimeKind.Unspecified), + EntryMode = 1, + FK_InvoiceId = new Guid("34500000-0000-0000-0000-000000000002"), + IsActive = true, + Method = 1, + RecordedBy = new Guid("29000000-0000-0000-0000-000000000001") + }, + new + { + Id = new Guid("47000000-0000-0000-0000-000000000004"), + Amount = 300m, + CollectedAt = new DateTime(2026, 8, 31, 11, 5, 0, 0, DateTimeKind.Unspecified), + CollectedBy = new Guid("29000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 31, 11, 5, 0, 0, DateTimeKind.Unspecified), + EntryMode = 0, + FK_InvoiceId = new Guid("34500000-0000-0000-0000-000000000002"), + IsActive = true, + Method = 2 + }); + }); + + modelBuilder.Entity("Distribution.Models.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("Permissions"); + + b.HasData( + new + { + Id = new Guid("20000000-0000-0000-0000-000000000001"), + Code = "orders.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View shop POs, invoices, payments and returns", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000002"), + Code = "rides.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage delivery rides and delivery tasks", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000003"), + Code = "loading.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage loading sheets", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000004"), + Code = "stores.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View store accounts, credit limits and balances", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000005"), + Code = "sales_visits.checkin", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Check in and out of scheduled store visits", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000006"), + Code = "items.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage catalogue products", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000007"), + Code = "categories.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage product categories and brands", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000008"), + Code = "warehouses.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View stock balances, movements, warehouses and reports", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000009"), + Code = "purchase_orders.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage purchase orders, GRNs and supplier claims", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000010"), + Code = "pricelists.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage regional price lists", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000011"), + Code = "schemes.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage pricing schemes and promotions", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000012"), + Code = "suppliers.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage supplier accounts", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000013"), + Code = "driver_profiles.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage driver profiles and licensing", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000014"), + Code = "compliance.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Manage driver compliance rules", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000015"), + Code = "users.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage staff user accounts", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000016"), + Code = "roles.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage roles and their permission sets", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000017"), + Code = "regions.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage regions and region configuration", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000018"), + Code = "routes.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage delivery routes", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000019"), + Code = "vehicles.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View and manage fleet vehicles", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000020"), + Code = "claim.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View agency claims and settlement status", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000021"), + Code = "claim.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and settle agency claims", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000022"), + Code = "delivery-task.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View delivery tasks within a ride", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000023"), + Code = "delivery-task.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Confirm and fail delivery tasks", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000024"), + Code = "driver.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View driver profiles and license details", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000025"), + Code = "driver.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and update driver profiles", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000026"), + Code = "grn.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View goods receipt notes", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000027"), + Code = "grn.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and confirm goods receipts", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000028"), + Code = "loading-sheet.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View loading sheets and their items", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000029"), + Code = "loading-sheet.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create, edit, and confirm loading sheets", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000030"), + Code = "price-list.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View regional price lists", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000031"), + Code = "price-list.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and manage item price lists", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000032"), + Code = "purchase-order.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View purchase orders and line items", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000033"), + Code = "purchase-order.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create, confirm, and close purchase orders", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000034"), + Code = "purchase-return.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and manage purchase returns to suppliers", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000035"), + Code = "region.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View regions and their configuration", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000036"), + Code = "region.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and update regions, targets, and budgets", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000037"), + Code = "return.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View order returns", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000038"), + Code = "return.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and manage order returns", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000039"), + Code = "route.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View delivery routes", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000040"), + Code = "route.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and manage delivery routes", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000041"), + Code = "scheme.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View pricing schemes and promotions", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000042"), + Code = "scheme.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and configure pricing schemes", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000043"), + Code = "stock.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View stock balances and movements", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000044"), + Code = "stock.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Transfer stock and record damage or adjustments", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000045"), + Code = "store.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View store accounts and balances", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000046"), + Code = "store.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and update store accounts", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000047"), + Code = "supplier-claim.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View supplier claims", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000048"), + Code = "supplier-claim.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Create and resolve supplier claims", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000049"), + Code = "sys-config.view", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "View system configuration settings", + IsActive = true + }, + new + { + Id = new Guid("20000000-0000-0000-0000-000000000050"), + Code = "sys-config.manage", + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Description = "Update system configuration settings", + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.PriceList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("EffectiveFrom") + .HasColumnType("datetime(6)"); + + b.Property("EffectiveTo") + .HasColumnType("datetime(6)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_RegionId"); + + b.ToTable("PriceLists"); + + b.HasData( + new + { + Id = new Guid("39000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EffectiveFrom = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EffectiveTo = new DateTime(2026, 12, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true, + Name = "Western Province Price List" + }); + }); + + modelBuilder.Entity("Distribution.Models.PriceListItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AgencyMarginPercent") + .HasColumnType("decimal(65,30)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_PriceListId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("MinPrice") + .HasColumnType("decimal(65,30)"); + + b.Property("Price") + .HasColumnType("decimal(65,30)"); + + b.Property("RetailPrice") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_PriceListId", "FK_ItemId") + .IsUnique(); + + b.ToTable("PriceListItems"); + + b.HasData( + new + { + Id = new Guid("40000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_PriceListId = new Guid("39000000-0000-0000-0000-000000000001"), + IsActive = true, + MinPrice = 55m, + Price = 60m + }, + new + { + Id = new Guid("40000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + FK_PriceListId = new Guid("39000000-0000-0000-0000-000000000001"), + IsActive = true, + MinPrice = 45m, + Price = 50m + }); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CancelReason") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_CreatedByUserId") + .HasColumnType("char(36)"); + + b.Property("FK_SupplierId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_SupplierId"); + + b.ToTable("PurchaseOrders"); + + b.HasData( + new + { + Id = new Guid("41000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_CreatedByUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_SupplierId = new Guid("38000000-0000-0000-0000-000000000001"), + IsActive = true, + Status = 2 + }, + new + { + Id = new Guid("41000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_CreatedByUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_SupplierId = new Guid("38000000-0000-0000-0000-000000000002"), + IsActive = true, + Status = 2 + }); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseOrderItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CancelledQuantity") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_PurchaseOrderId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ReceivedQuantity") + .HasColumnType("int"); + + b.Property("UnitCost") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_PurchaseOrderId"); + + b.ToTable("PurchaseOrderItems"); + + b.HasData( + new + { + Id = new Guid("42000000-0000-0000-0000-000000000001"), + CancelledQuantity = 0, + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_PurchaseOrderId = new Guid("41000000-0000-0000-0000-000000000001"), + IsActive = true, + IsCancelled = false, + Quantity = 200, + ReceivedQuantity = 200, + UnitCost = 40m + }, + new + { + Id = new Guid("42000000-0000-0000-0000-000000000002"), + CancelledQuantity = 0, + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000002"), + FK_PurchaseOrderId = new Guid("41000000-0000-0000-0000-000000000001"), + IsActive = true, + IsCancelled = false, + Quantity = 100, + ReceivedQuantity = 98, + UnitCost = 80m + }, + new + { + Id = new Guid("42000000-0000-0000-0000-000000000003"), + CancelledQuantity = 0, + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + FK_PurchaseOrderId = new Guid("41000000-0000-0000-0000-000000000002"), + IsActive = true, + IsCancelled = false, + Quantity = 150, + ReceivedQuantity = 150, + UnitCost = 35m + }); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseReturn", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_PurchaseOrderId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_PurchaseOrderId"); + + b.ToTable("PurchaseReturns"); + + b.HasData( + new + { + Id = new Guid("45000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_PurchaseOrderId = new Guid("41000000-0000-0000-0000-000000000002"), + IsActive = true, + Reason = "Damaged in transit" + }); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseReturnItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_PurchaseReturnId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_PurchaseReturnId"); + + b.ToTable("PurchaseReturnItems"); + + b.HasData( + new + { + Id = new Guid("46000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + FK_PurchaseReturnId = new Guid("45000000-0000-0000-0000-000000000001"), + IsActive = true, + Quantity = 10 + }); + }); + + modelBuilder.Entity("Distribution.Models.ReceivedCheque", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AccountHolderName") + .HasColumnType("longtext"); + + b.Property("Amount") + .HasColumnType("decimal(65,30)"); + + b.Property("BranchId") + .HasColumnType("int"); + + b.Property("ChequeDate") + .HasColumnType("datetime(6)"); + + b.Property("ChequeNo") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CompanyId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedBy") + .HasColumnType("longtext"); + + b.Property("DepositDate") + .HasColumnType("datetime(6)"); + + b.Property("DrawerBankBranch") + .HasColumnType("longtext"); + + b.Property("DrawerBankName") + .HasColumnType("longtext"); + + b.Property("FK_DepositBankAccountId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Notes") + .HasColumnType("longtext"); + + b.Property("ReceivedDate") + .HasColumnType("datetime(6)"); + + b.Property("ReceivedFromId") + .HasColumnType("int"); + + b.Property("ReceivedFromName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ReceivedFromType") + .HasColumnType("int"); + + b.Property("ReferenceId") + .HasColumnType("int"); + + b.Property("ReferenceType") + .HasColumnType("longtext"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ChequeNo"); + + b.HasIndex("FK_DepositBankAccountId"); + + b.ToTable("ReceivedCheques"); + }); + + modelBuilder.Entity("Distribution.Models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("Code") + .IsUnique(); + + b.ToTable("Regions"); + + b.HasData( + new + { + Id = new Guid("24000000-0000-0000-0000-000000000001"), + Code = "REG-0001", + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Western Province" + }, + new + { + Id = new Guid("24000000-0000-0000-0000-000000000002"), + Code = "REG-0002", + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Central Province" + }); + }); + + modelBuilder.Entity("Distribution.Models.RegionAgencyMap", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_AgencyUserId") + .HasColumnType("char(36)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("FK_AgencyUserId"); + + b.HasIndex("FK_RegionId", "FK_AgencyUserId") + .IsUnique(); + + b.ToTable("RegionAgencyMaps"); + + b.HasData( + new + { + Id = new Guid("57000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_AgencyUserId = new Guid("70000000-0000-0000-0000-000000000001"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.RegionalBudget", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BudgetAmount") + .HasColumnType("decimal(65,30)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Period") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("FK_RegionId", "Period") + .IsUnique(); + + b.ToTable("RegionalBudgets"); + + b.HasData( + new + { + Id = new Guid("58000000-0000-0000-0000-000000000001"), + BudgetAmount = 200000m, + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true, + Period = "2026-08" + }); + }); + + modelBuilder.Entity("Distribution.Models.RegionalTarget", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Period") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("TargetValue") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_RegionId", "Period") + .IsUnique(); + + b.ToTable("RegionalTargets"); + + b.HasData( + new + { + Id = new Guid("59000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true, + Period = "2026-08", + TargetValue = 500000m + }); + }); + + modelBuilder.Entity("Distribution.Models.RegionalTaxRule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("RuleConfig") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_RegionId") + .IsUnique(); + + b.ToTable("RegionalTaxRules"); + + b.HasData( + new + { + Id = new Guid("60000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true, + RuleConfig = "{\"rate\": 0.15}" + }); + }); + + modelBuilder.Entity("Distribution.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + + b.HasData( + new + { + Id = new Guid("10000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 10, + Name = "SalesRep" + }, + new + { + Id = new Guid("10000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 20, + Name = "Supervisor" + }, + new + { + Id = new Guid("10000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 30, + Name = "AreaManager" + }, + new + { + Id = new Guid("10000000-0000-0000-0000-000000000004"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 40, + Name = "AreaSupervisor" + }, + new + { + Id = new Guid("10000000-0000-0000-0000-000000000005"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 50, + Name = "RegionalManager" + }, + new + { + Id = new Guid("10000000-0000-0000-0000-000000000006"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 60, + Name = "RegionalAgency" + }, + new + { + Id = new Guid("10000000-0000-0000-0000-000000000007"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Level = 100, + Name = "SuperAdmin" + }); + }); + + modelBuilder.Entity("Distribution.Models.RolePermission", b => + { + b.Property("FK_RoleId") + .HasColumnType("char(36)"); + + b.Property("FK_PermissionId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("FK_RoleId", "FK_PermissionId"); + + b.HasIndex("FK_PermissionId"); + + b.ToTable("RolePermissions"); + + b.HasData( + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("ec13fdfa-d848-4004-b749-4b455ba0a77e"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("66f41359-cf33-4bd9-a936-816f03b23da7"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("369efbe7-f200-4b2e-bc15-858b6d2ca882"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000004"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("adc14999-08af-4b4c-937d-3ecd7c35b709"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000005"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("f1bf4ccb-45c6-4915-b941-6b507eb1e44f"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000006"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("1cbd132a-ea3d-46b2-8150-c5a077b6b36a"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000007"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("362118bd-1d4c-4576-95f6-7da899bf7368"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000008"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("15e94675-d2ae-4f5a-8198-6297a26d7a2c"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000009"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("4af2ab93-d3ba-4bda-b440-167f672cc166"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000010"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("bc5ba5f8-f20a-432a-985b-95b9500ce693"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000011"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("4f43f82b-8e6a-4729-9ded-c78c7dde24a7"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000012"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("7ac3df8c-f5c3-4d57-b537-5d5ca4ec1e11"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000013"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("44ec8d0f-f540-4786-9d9a-9194fa091286"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000014"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("143c4280-21be-4852-adc5-7cd17ab595fd"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000015"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("d00b144e-bf2d-4a04-9c85-0c14544edf48"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000016"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("9a72b7e4-1197-4032-8ec6-ebb3442a267f"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000017"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("5ec2af6e-d1db-4811-9c37-94a260e6ef9b"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000018"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("a71aceba-5199-4824-8b4e-998b108c082c"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000019"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("4bd840bf-da52-46fd-b065-40253f915c7c"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000020"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("8b4d8558-dba9-45bb-b263-f066580a55e9"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000021"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("0ee1a2e0-e4d2-4af3-9cca-ffad05bc1e20"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000022"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("700be5ec-0c11-497b-808a-80e7a854d2b4"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000023"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("b9978e5a-14b1-462a-9b7b-c9c32c4decb9"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000024"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("1e7cc9d4-f65e-434b-90e5-f78b4fda39b8"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000025"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("bfb3f80b-32c3-43b0-b216-f05e55f09360"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000026"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("fcfe2242-93ad-4c6d-8eec-3ec1f1270d0a"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000027"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("8e6eeb90-966f-4417-a1ae-148cdaa64904"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000028"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("6df60aea-63f3-465e-96fb-9a7304ead3c2"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000029"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("c0e21519-a095-4c7f-af42-e26efdcdd31e"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000030"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("496bbf8d-d84d-4c21-b190-bf95a06b4113"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000031"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("36f55476-d749-459b-92d9-839919499460"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000032"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("d90301fa-8990-49cf-8fa0-228ea7e684bc"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000033"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("8da4cd2a-1fd2-4417-bb6d-9e91174193f5"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000034"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("cc9bed46-a230-4611-88b4-d568abca857e"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000035"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("4d791413-ac44-4165-87b8-c28dbfa49230"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000036"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("2bb28028-8b12-4937-9dc6-68e35b100007"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000037"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("fdc8d3d9-a32d-4322-8144-93ff677beea3"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000038"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("b1ea0901-08e8-4dea-8ac3-15b522a2f274"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000039"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("116ac7bf-741e-4d4f-a313-2e7946a50044"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000040"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("7fd97ca6-a14b-4e42-8474-5471c0ef79a9"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000041"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("e58f35b2-8308-4fbb-b3ca-db9d037347cd"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000042"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("dc6b2750-083b-4653-a986-7af7aaec8136"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000043"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("6629888a-eb6b-433f-bbfe-ee5d947fb5b2"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000044"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("94b97271-7593-4cec-9290-802e9a26f0d8"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000045"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("0dc88aca-4e86-4712-988f-8db6a466531d"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000046"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("c8839187-4358-4218-bf3d-5ea4ed758661"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000047"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("5c731906-8d81-4f85-abad-230050af0bd0"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000048"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("d6e3db40-ca38-4caf-88d8-ce87475b4d87"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000049"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("398f1c4d-5d7d-4af4-9aa7-a88d7abf9a33"), + IsActive = true + }, + new + { + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000050"), + CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("0f6c66e6-833c-4b52-ba2c-09da8dbead6f"), + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.Route", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("EndPoint") + .HasColumnType("longtext"); + + b.Property("FK_OwnerUserId") + .HasColumnType("char(36)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasColumnType("decimal(65,30)"); + + b.Property("RouteName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartPoint") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_OwnerUserId"); + + b.HasIndex("FK_RegionId"); + + b.ToTable("Routes"); + + b.HasData( + new + { + Id = new Guid("25000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndPoint = "Dehiwala", + FK_OwnerUserId = new Guid("29000000-0000-0000-0000-000000000002"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true, + Length = 18.5m, + RouteName = "Colombo City Route", + StartPoint = "Colombo Fort" + }, + new + { + Id = new Guid("25000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndPoint = "Negombo", + FK_OwnerUserId = new Guid("29000000-0000-0000-0000-000000000002"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + IsActive = true, + Length = 32.0m, + RouteName = "Negombo Coastal Route", + StartPoint = "Wattala" + }, + new + { + Id = new Guid("25000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndPoint = "Peradeniya", + FK_OwnerUserId = new Guid("29000000-0000-0000-0000-000000000003"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000002"), + IsActive = true, + Length = 12.0m, + RouteName = "Kandy Town Route", + StartPoint = "Kandy Lake" + }, + new + { + Id = new Guid("25000000-0000-0000-0000-000000000004"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndPoint = "Matale", + FK_OwnerUserId = new Guid("29000000-0000-0000-0000-000000000003"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000002"), + IsActive = true, + Length = 26.0m, + RouteName = "Matale Route", + StartPoint = "Kandy" + }); + }); + + modelBuilder.Entity("Distribution.Models.RouteVisitLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckInAt") + .HasColumnType("datetime(6)"); + + b.Property("CheckInLatitude") + .HasColumnType("decimal(65,30)"); + + b.Property("CheckInLongitude") + .HasColumnType("decimal(65,30)"); + + b.Property("CheckOutAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_RouteId") + .HasColumnType("char(36)"); + + b.Property("FK_StoreId") + .HasColumnType("char(36)"); + + b.Property("FK_UserId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeviationFlagged") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("FK_RouteId"); + + b.HasIndex("FK_StoreId"); + + b.HasIndex("FK_UserId"); + + b.ToTable("RouteVisitLogs"); + + b.HasData( + new + { + Id = new Guid("66000000-0000-0000-0000-000000000001"), + CheckInAt = new DateTime(2026, 8, 25, 9, 0, 0, 0, DateTimeKind.Unspecified), + CheckInLatitude = 6.9344m, + CheckInLongitude = 79.8428m, + CheckOutAt = new DateTime(2026, 8, 25, 9, 25, 0, 0, DateTimeKind.Unspecified), + CreatedAt = new DateTime(2026, 8, 25, 9, 0, 0, 0, DateTimeKind.Unspecified), + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000001"), + FK_StoreId = new Guid("26000000-0000-0000-0000-000000000001"), + FK_UserId = new Guid("29000000-0000-0000-0000-000000000002"), + IsActive = true, + IsDeviationFlagged = false + }, + new + { + Id = new Guid("66000000-0000-0000-0000-000000000002"), + CheckInAt = new DateTime(2026, 8, 25, 10, 0, 0, 0, DateTimeKind.Unspecified), + CheckInLatitude = 6.9000m, + CheckInLongitude = 79.8654m, + CreatedAt = new DateTime(2026, 8, 25, 10, 0, 0, 0, DateTimeKind.Unspecified), + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000001"), + FK_StoreId = new Guid("26000000-0000-0000-0000-000000000002"), + FK_UserId = new Guid("29000000-0000-0000-0000-000000000002"), + IsActive = true, + IsDeviationFlagged = true + }); + }); + + modelBuilder.Entity("Distribution.Models.SaleReturn", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByUserId") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Mode") + .HasColumnType("int"); + + b.Property("TotalCreditAmount") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByUserId"); + + b.HasIndex("FK_ShopPOId"); + + b.ToTable("SaleReturns"); + + b.HasData( + new + { + Id = new Guid("51000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreatedByUserId = new Guid("29000000-0000-0000-0000-000000000002"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000001"), + IsActive = true, + Mode = 0, + TotalCreditAmount = 300m + }); + }); + + modelBuilder.Entity("Distribution.Models.SaleReturnItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_SaleReturnId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Quantity") + .HasColumnType("decimal(65,30)"); + + b.Property("ReasonCode") + .HasColumnType("int"); + + b.Property("UnitPrice") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_SaleReturnId"); + + b.ToTable("SaleReturnItems"); + + b.HasData( + new + { + Id = new Guid("52000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_SaleReturnId = new Guid("51000000-0000-0000-0000-000000000001"), + IsActive = true, + Quantity = 5m, + ReasonCode = 1, + UnitPrice = 60m + }); + }); + + modelBuilder.Entity("Distribution.Models.SaleRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("SaleRoutes"); + + b.HasData( + new + { + Id = new Guid("69000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true + }, + new + { + Id = new Guid("69000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.Scheme", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AgentLimitExempt") + .HasColumnType("tinyint(1)"); + + b.Property("BaselineExpectedSales") + .HasColumnType("decimal(65,30)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DateRangeFrom") + .HasColumnType("datetime(6)"); + + b.Property("DateRangeTo") + .HasColumnType("datetime(6)"); + + b.Property("EligibleSegment") + .HasColumnType("longtext"); + + b.Property("FK_FreeItemId") + .HasColumnType("char(36)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("FK_TriggerItemId") + .HasColumnType("char(36)"); + + b.Property("FreeQty") + .HasColumnType("decimal(65,30)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("RegionId") + .HasColumnType("char(36)"); + + b.Property("RuleConfig") + .HasColumnType("longtext"); + + b.Property("RuleType") + .HasColumnType("int"); + + b.Property("TriggerQty") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_FreeItemId"); + + b.HasIndex("FK_TriggerItemId"); + + b.HasIndex("RegionId"); + + b.ToTable("Schemes"); + + b.HasData( + new + { + Id = new Guid("48000000-0000-0000-0000-000000000001"), + AgentLimitExempt = false, + BaselineExpectedSales = 500000m, + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateRangeFrom = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateRangeTo = new DateTime(2026, 12, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_FreeItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + FK_TriggerItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FreeQty = 1m, + IsActive = true, + Name = "Buy 10 Coke Get 1 Free", + RuleType = 0, + TriggerQty = 10 + }, + new + { + Id = new Guid("48000000-0000-0000-0000-000000000002"), + AgentLimitExempt = false, + CreatedAt = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateRangeFrom = new DateTime(2026, 8, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateRangeTo = new DateTime(2026, 12, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_FreeItemId = new Guid("23000000-0000-0000-0000-000000000004"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000002"), + FreeQty = 1m, + IsActive = true, + Name = "Snack Combo Bundle", + RuleType = 3 + }); + }); + + modelBuilder.Entity("Distribution.Models.SchemeBundleComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_SchemeId") + .HasColumnType("char(36)"); + + b.Property("Qty") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_SchemeId", "FK_ItemId") + .IsUnique(); + + b.ToTable("SchemeBundleComponents"); + + b.HasData( + new + { + Id = new Guid("49000000-0000-0000-0000-000000000001"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + FK_SchemeId = new Guid("48000000-0000-0000-0000-000000000002"), + Qty = 5 + }); + }); + + modelBuilder.Entity("Distribution.Models.SchemeRedemption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DiscountAmount") + .HasColumnType("decimal(65,30)"); + + b.Property("FK_FreeItemId") + .HasColumnType("char(36)"); + + b.Property("FK_SchemeId") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOId") + .HasColumnType("char(36)"); + + b.Property("FieldInvoiceId") + .HasColumnType("char(36)"); + + b.Property("FreeItemCostValue") + .HasColumnType("decimal(65,30)"); + + b.Property("FreeQty") + .HasColumnType("decimal(65,30)"); + + b.Property("RedeemedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("FK_FreeItemId"); + + b.HasIndex("FK_SchemeId"); + + b.HasIndex("FK_ShopPOId"); + + b.ToTable("SchemeRedemptions"); + + b.HasData( + new + { + Id = new Guid("50000000-0000-0000-0000-000000000001"), + DiscountAmount = 0m, + FK_FreeItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_SchemeId = new Guid("48000000-0000-0000-0000-000000000001"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000001"), + FreeItemCostValue = 40m, + FreeQty = 1m, + RedeemedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Distribution.Models.ShopPO", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CancelReason") + .HasColumnType("longtext"); + + b.Property("CancelledAt") + .HasColumnType("datetime(6)"); + + b.Property("CancelledBy") + .HasColumnType("char(36)"); + + b.Property("ConfirmedAt") + .HasColumnType("datetime(6)"); + + b.Property("ConfirmedBy") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_StoreId") + .HasColumnType("char(36)"); + + b.Property("FulfilledAt") + .HasColumnType("datetime(6)"); + + b.Property("InvoiceId") + .HasColumnType("char(36)") + .HasColumnName("InvoiceId"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("RaisedById") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalAmount") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_StoreId"); + + b.ToTable("ShopPOs"); + + b.HasData( + new + { + Id = new Guid("33000000-0000-0000-0000-000000000001"), + ConfirmedAt = new DateTime(2026, 8, 25, 8, 30, 0, 0, DateTimeKind.Unspecified), + ConfirmedBy = new Guid("29000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 25, 9, 0, 0, 0, DateTimeKind.Unspecified), + FK_StoreId = new Guid("26000000-0000-0000-0000-000000000001"), + FulfilledAt = new DateTime(2026, 8, 25, 13, 0, 0, 0, DateTimeKind.Unspecified), + InvoiceId = new Guid("34500000-0000-0000-0000-000000000001"), + IsActive = true, + RaisedById = new Guid("29000000-0000-0000-0000-000000000002"), + Status = 2, + TotalAmount = 3000m + }, + new + { + Id = new Guid("33000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 30, 10, 0, 0, 0, DateTimeKind.Unspecified), + FK_StoreId = new Guid("26000000-0000-0000-0000-000000000005"), + IsActive = true, + RaisedById = new Guid("29000000-0000-0000-0000-000000000003"), + Status = 0, + TotalAmount = 1200m + }, + new + { + Id = new Guid("33000000-0000-0000-0000-000000000003"), + ConfirmedAt = new DateTime(2026, 8, 31, 8, 30, 0, 0, DateTimeKind.Unspecified), + ConfirmedBy = new Guid("29000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 31, 9, 0, 0, 0, DateTimeKind.Unspecified), + FK_StoreId = new Guid("26000000-0000-0000-0000-000000000005"), + FulfilledAt = new DateTime(2026, 8, 31, 13, 0, 0, 0, DateTimeKind.Unspecified), + InvoiceId = new Guid("34500000-0000-0000-0000-000000000002"), + IsActive = true, + RaisedById = new Guid("29000000-0000-0000-0000-000000000003"), + Status = 2, + TotalAmount = 2400m + }); + }); + + modelBuilder.Entity("Distribution.Models.ShopPOItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_ShopPOId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("QuantityFulfilled") + .HasColumnType("int"); + + b.Property("UnitPrice") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_ShopPOId"); + + b.ToTable("ShopPOItems"); + + b.HasData( + new + { + Id = new Guid("34000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 25, 9, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000001"), + IsActive = true, + Quantity = 30, + QuantityFulfilled = 30, + UnitPrice = 60m + }, + new + { + Id = new Guid("34000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 25, 9, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000001"), + IsActive = true, + Quantity = 24, + QuantityFulfilled = 24, + UnitPrice = 50m + }, + new + { + Id = new Guid("34000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 30, 10, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000002"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000002"), + IsActive = true, + Quantity = 10, + QuantityFulfilled = 0, + UnitPrice = 120m + }, + new + { + Id = new Guid("34000000-0000-0000-0000-000000000004"), + CreatedAt = new DateTime(2026, 8, 31, 9, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000002"), + FK_ShopPOId = new Guid("33000000-0000-0000-0000-000000000003"), + IsActive = true, + Quantity = 20, + QuantityFulfilled = 20, + UnitPrice = 120m + }); + }); + + modelBuilder.Entity("Distribution.Models.StockBalance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("FK_ItemBatchId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemSerialNumberId") + .HasColumnType("char(36)"); + + b.Property("LocationId") + .HasColumnType("char(36)"); + + b.Property("LocationType") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("decimal(65,30)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemBatchId"); + + b.HasIndex("FK_ItemSerialNumberId"); + + b.HasIndex("FK_ItemId", "LocationId", "FK_ItemBatchId", "FK_ItemSerialNumberId") + .IsUnique(); + + b.ToTable("StockBalances"); + + b.HasData( + new + { + Id = new Guid("61000000-0000-0000-0000-000000000001"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + LocationId = new Guid("27000000-0000-0000-0000-000000000001"), + LocationType = 0, + Quantity = 150m, + UpdatedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified) + }, + new + { + Id = new Guid("61000000-0000-0000-0000-000000000002"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000003"), + LocationId = new Guid("27000000-0000-0000-0000-000000000001"), + LocationType = 0, + Quantity = 90m, + UpdatedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified) + }, + new + { + Id = new Guid("61000000-0000-0000-0000-000000000003"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + LocationId = new Guid("28000000-0000-0000-0000-000000000001"), + LocationType = 1, + Quantity = 20m, + UpdatedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Distribution.Models.StockMovement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedBy") + .HasColumnType("char(36)"); + + b.Property("FK_ItemBatchId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemSerialNumberId") + .HasColumnType("char(36)"); + + b.Property("FromLocationId") + .HasColumnType("char(36)"); + + b.Property("FromLocationType") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("decimal(65,30)"); + + b.Property("ReasonCode") + .HasColumnType("longtext"); + + b.Property("ReferenceId") + .HasColumnType("char(36)"); + + b.Property("ToLocationId") + .HasColumnType("char(36)"); + + b.Property("ToLocationType") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemBatchId"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_ItemSerialNumberId"); + + b.ToTable("StockMovements"); + + b.HasData( + new + { + Id = new Guid("62000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreatedBy = new Guid("29000000-0000-0000-0000-000000000001"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FromLocationId = new Guid("00000000-0000-0000-0000-000000000000"), + FromLocationType = 2, + Quantity = 200m, + ReferenceId = new Guid("43000000-0000-0000-0000-000000000001"), + ToLocationId = new Guid("27000000-0000-0000-0000-000000000001"), + ToLocationType = 0, + Type = 6 + }, + new + { + Id = new Guid("62000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 25, 7, 30, 0, 0, DateTimeKind.Unspecified), + CreatedBy = new Guid("29000000-0000-0000-0000-000000000001"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FromLocationId = new Guid("27000000-0000-0000-0000-000000000001"), + FromLocationType = 0, + Quantity = 50m, + ReferenceId = new Guid("35000000-0000-0000-0000-000000000001"), + ToLocationId = new Guid("28000000-0000-0000-0000-000000000001"), + ToLocationType = 1, + Type = 5 + }, + new + { + Id = new Guid("62000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 25, 9, 30, 0, 0, DateTimeKind.Unspecified), + CreatedBy = new Guid("29000000-0000-0000-0000-000000000002"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FromLocationId = new Guid("28000000-0000-0000-0000-000000000001"), + FromLocationType = 1, + Quantity = 30m, + ReferenceId = new Guid("32000000-0000-0000-0000-000000000001"), + ToLocationId = new Guid("00000000-0000-0000-0000-000000000000"), + ToLocationType = 2, + Type = 0 + }); + }); + + modelBuilder.Entity("Distribution.Models.Store", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreditAmount") + .HasColumnType("decimal(65,30)"); + + b.Property("CreditLimit") + .HasColumnType("decimal(65,30)"); + + b.Property("FK_RouteId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("decimal(65,30)"); + + b.Property("Longitude") + .HasColumnType("decimal(65,30)"); + + b.Property("OneTimeAmount") + .HasColumnType("decimal(65,30)"); + + b.Property("OutstandingBalance") + .HasColumnType("decimal(65,30)"); + + b.Property("OwnerName") + .HasColumnType("longtext"); + + b.Property("Segment") + .HasColumnType("longtext"); + + b.Property("StoreAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StoreName") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_RouteId"); + + b.ToTable("Stores"); + + b.HasData( + new + { + Id = new Guid("26000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreditAmount = 0m, + CreditLimit = 50000m, + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000001"), + IsActive = true, + Latitude = 6.9344m, + Longitude = 79.8428m, + OneTimeAmount = 0m, + OutstandingBalance = 0m, + OwnerName = "Saman Kumara", + Segment = "Gold", + StoreAddress = "12 York Street, Colombo Fort", + StoreName = "Fort Mini Mart" + }, + new + { + Id = new Guid("26000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreditAmount = 0m, + CreditLimit = 30000m, + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000001"), + IsActive = true, + Latitude = 6.8508m, + Longitude = 79.8654m, + OneTimeAmount = 0m, + OutstandingBalance = 5000m, + OwnerName = "Nadeesha Silva", + Segment = "Silver", + StoreAddress = "45 Galle Road, Dehiwala", + StoreName = "Dehiwala Grocery" + }, + new + { + Id = new Guid("26000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreditAmount = 0m, + CreditLimit = 40000m, + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000002"), + IsActive = true, + Latitude = 6.9890m, + Longitude = 79.8912m, + OneTimeAmount = 0m, + OutstandingBalance = 1200m, + OwnerName = "Ruwan Gunasekara", + Segment = "Gold", + StoreAddress = "88 Negombo Road, Wattala", + StoreName = "Wattala Supermarket" + }, + new + { + Id = new Guid("26000000-0000-0000-0000-000000000004"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreditAmount = 0m, + CreditLimit = 25000m, + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000002"), + IsActive = true, + Latitude = 7.2094m, + Longitude = 79.8380m, + OneTimeAmount = 0m, + OutstandingBalance = 0m, + OwnerName = "Chamari Peiris", + StoreAddress = "5 Beach Road, Negombo", + StoreName = "Negombo Beach Store" + }, + new + { + Id = new Guid("26000000-0000-0000-0000-000000000005"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreditAmount = 0m, + CreditLimit = 35000m, + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000003"), + IsActive = true, + Latitude = 7.2906m, + Longitude = 80.6337m, + OneTimeAmount = 0m, + OutstandingBalance = 0m, + OwnerName = "Dinesh Wickramasinghe", + Segment = "Key Account", + StoreAddress = "3 Lake Road, Kandy", + StoreName = "Kandy Lake View Store" + }, + new + { + Id = new Guid("26000000-0000-0000-0000-000000000006"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + CreditAmount = 0m, + CreditLimit = 20000m, + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000004"), + IsActive = true, + Latitude = 7.4675m, + Longitude = 80.6234m, + OneTimeAmount = 0m, + OutstandingBalance = 0m, + OwnerName = "Ishara Bandara", + StoreAddress = "20 Main Street, Matale", + StoreName = "Matale Central Store" + }); + }); + + modelBuilder.Entity("Distribution.Models.SubCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExternalErpId") + .HasColumnType("int"); + + b.Property("FK_CategoryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_CategoryId"); + + b.ToTable("SubCategories"); + }); + + modelBuilder.Entity("Distribution.Models.Supplier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactInfo") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PerformanceScore") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.ToTable("Suppliers"); + + b.HasData( + new + { + Id = new Guid("38000000-0000-0000-0000-000000000001"), + ContactInfo = "+94 11 234 5678", + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Ceylon Beverages Ltd", + PerformanceScore = 4.2m + }, + new + { + Id = new Guid("38000000-0000-0000-0000-000000000002"), + ContactInfo = "+94 11 876 5432", + CreatedAt = new DateTime(2026, 8, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Snack Foods (Pvt) Ltd" + }); + }); + + modelBuilder.Entity("Distribution.Models.SupplierClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Details") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EvidenceUrl") + .HasColumnType("longtext"); + + b.Property("FK_GoodsReceiptId") + .HasColumnType("char(36)"); + + b.Property("FK_PurchaseOrderId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("RaisedByUserId") + .HasColumnType("char(36)"); + + b.Property("ResolutionAmount") + .HasColumnType("decimal(65,30)"); + + b.Property("ResolutionNotes") + .HasColumnType("longtext"); + + b.Property("ResolutionType") + .HasColumnType("int"); + + b.Property("ResolvedAt") + .HasColumnType("datetime(6)"); + + b.Property("ResolvedByUserId") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FK_GoodsReceiptId"); + + b.HasIndex("FK_PurchaseOrderId"); + + b.HasIndex("RaisedByUserId"); + + b.HasIndex("ResolvedByUserId"); + + b.ToTable("SupplierClaims"); + + b.HasData( + new + { + Id = new Guid("55000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + Details = "2 units of Coke 1.5L received damaged", + FK_GoodsReceiptId = new Guid("43000000-0000-0000-0000-000000000001"), + FK_PurchaseOrderId = new Guid("41000000-0000-0000-0000-000000000001"), + IsActive = true, + RaisedByUserId = new Guid("29000000-0000-0000-0000-000000000001"), + ResolutionAmount = 160m, + ResolutionNotes = "Credited against next invoice", + ResolutionType = 1, + ResolvedAt = new DateTime(2026, 8, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), + ResolvedByUserId = new Guid("29000000-0000-0000-0000-000000000006"), + Status = 1 + }); + }); + + modelBuilder.Entity("Distribution.Models.SupplierClaimItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_SupplierClaimId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IssueType") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_SupplierClaimId"); + + b.ToTable("SupplierClaimItems"); + + b.HasData( + new + { + Id = new Guid("56000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000002"), + FK_SupplierClaimId = new Guid("55000000-0000-0000-0000-000000000001"), + IsActive = true, + IssueType = 0, + Quantity = 2m + }); + }); + + modelBuilder.Entity("Distribution.Models.SysConfig", b => + { + b.Property("Key") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Key"); + + b.ToTable("SysConfigs"); + + b.HasData( + new + { + Key = "InvoiceCreationMode", + UpdatedAt = new DateTime(2026, 9, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "ModeB" + }, + new + { + Key = "Feature.SerialNumberTracking", + UpdatedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "false" + }, + new + { + Key = "Feature.BatchTracking", + UpdatedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "false" + }, + new + { + Key = "Feature.ExpiryDateTracking", + UpdatedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "false" + }, + new + { + Key = "Feature.WarrantyTracking", + UpdatedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "false" + }, + new + { + Key = "Feature.CustomWarrantyOverride", + UpdatedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "false" + }, + new + { + Key = "Feature.DefaultWarrantyPeriodDays", + UpdatedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Value = "0" + }); + }); + + modelBuilder.Entity("Distribution.Models.Uom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExternalErpId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Uoms"); + + b.HasData( + new + { + Id = new Guid("22000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Piece" + }, + new + { + Id = new Guid("67000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Name = "Case" + }); + }); + + modelBuilder.Entity("Distribution.Models.UomConversion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("FK_FromUomId") + .HasColumnType("char(36)"); + + b.Property("FK_ItemId") + .HasColumnType("char(36)"); + + b.Property("FK_ToUomId") + .HasColumnType("char(36)"); + + b.Property("Factor") + .HasColumnType("decimal(65,30)"); + + b.HasKey("Id"); + + b.HasIndex("FK_FromUomId"); + + b.HasIndex("FK_ItemId"); + + b.HasIndex("FK_ToUomId"); + + b.ToTable("UomConversions"); + + b.HasData( + new + { + Id = new Guid("67000000-0000-0000-0000-000000000002"), + FK_FromUomId = new Guid("67000000-0000-0000-0000-000000000001"), + FK_ItemId = new Guid("23000000-0000-0000-0000-000000000001"), + FK_ToUomId = new Guid("22000000-0000-0000-0000-000000000001"), + Factor = 24m + }); + }); + + modelBuilder.Entity("Distribution.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FK_ReportsToUserId") + .HasColumnType("char(36)"); + + b.Property("FK_RoleId") + .HasColumnType("char(36)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Username") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FK_ReportsToUserId"); + + b.HasIndex("FK_RoleId"); + + b.ToTable("Users"); + + b.HasData( + new + { + Id = new Guid("29000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000002"), + FullName = "Sunil Fernando", + IsActive = true, + Username = "sunil.fernando" + }, + new + { + Id = new Guid("29000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ReportsToUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000001"), + FullName = "Nimal Perera", + IsActive = true, + Username = "nimal.perera" + }, + new + { + Id = new Guid("29000000-0000-0000-0000-000000000003"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ReportsToUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000001"), + FullName = "Kamal Silva", + IsActive = true, + Username = "kamal.silva" + }, + new + { + Id = new Guid("29000000-0000-0000-0000-000000000004"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ReportsToUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000001"), + FullName = "Ruwan Jayasuriya", + IsActive = true, + Username = "ruwan.jayasuriya" + }, + new + { + Id = new Guid("29000000-0000-0000-0000-000000000005"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_ReportsToUserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000001"), + FullName = "Priyantha Kumara", + IsActive = true, + Username = "priyantha.kumara" + }, + new + { + Id = new Guid("29000000-0000-0000-0000-000000000006"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000005"), + FullName = "Priya Rajapaksa", + IsActive = true, + Username = "priya.rajapaksa" + }, + new + { + Id = new Guid("70000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000006"), + FullName = "Channa De Silva", + IsActive = true, + Username = "channa.desilva" + }, + new + { + Id = new Guid("00000001-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 10, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), + FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), + FullName = "Super Admin", + IsActive = true, + Username = "superadmin" + }); + }); + + modelBuilder.Entity("Distribution.Models.UserRegionScope", b => + { + b.Property("FK_UserId") + .HasColumnType("char(36)"); + + b.Property("FK_RegionId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("FK_UserId", "FK_RegionId"); + + b.HasIndex("FK_RegionId"); + + b.ToTable("UserRegionScopes"); + + b.HasData( + new + { + FK_UserId = new Guid("29000000-0000-0000-0000-000000000006"), + FK_RegionId = new Guid("24000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("68000000-0000-0000-0000-000000000001"), + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.UserRouteScope", b => + { + b.Property("FK_UserId") + .HasColumnType("char(36)"); + + b.Property("FK_RouteId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("FK_UserId", "FK_RouteId"); + + b.HasIndex("FK_RouteId"); + + b.ToTable("UserRouteScopes"); + + b.HasData( + new + { + FK_UserId = new Guid("29000000-0000-0000-0000-000000000001"), + FK_RouteId = new Guid("25000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("68000000-0000-0000-0000-000000000002"), + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.UserStoreScope", b => + { + b.Property("FK_UserId") + .HasColumnType("char(36)"); + + b.Property("FK_StoreId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.HasKey("FK_UserId", "FK_StoreId"); + + b.HasIndex("FK_StoreId"); + + b.ToTable("UserStoreScopes"); + + b.HasData( + new + { + FK_UserId = new Guid("29000000-0000-0000-0000-000000000003"), + FK_StoreId = new Guid("26000000-0000-0000-0000-000000000005"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + Id = new Guid("68000000-0000-0000-0000-000000000003"), + IsActive = true + }); + }); + + modelBuilder.Entity("Distribution.Models.Vehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DefaultWarehouseId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("NumberPlate") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("RegNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DefaultWarehouseId"); + + b.ToTable("Vehicles"); + + b.HasData( + new + { + Id = new Guid("28000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + DefaultWarehouseId = new Guid("27000000-0000-0000-0000-000000000001"), + IsActive = true, + NumberPlate = "CAB-1234", + RegNumber = "WP-CAB-1234", + Type = 2 + }, + new + { + Id = new Guid("28000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + DefaultWarehouseId = new Guid("27000000-0000-0000-0000-000000000002"), + IsActive = true, + NumberPlate = "KY-5678", + RegNumber = "CP-KY-5678", + Type = 1 + }); + }); + + modelBuilder.Entity("Distribution.Models.Warehouse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Location") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("VehicleId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("Warehouses"); + + b.HasData( + new + { + Id = new Guid("27000000-0000-0000-0000-000000000001"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Location = "Peliyagoda, Colombo", + Name = "Colombo Distribution Center", + Type = 0 + }, + new + { + Id = new Guid("27000000-0000-0000-0000-000000000002"), + CreatedAt = new DateTime(2026, 8, 20, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsActive = true, + Location = "Katugastota, Kandy", + Name = "Kandy Fulfillment Center", + Type = 1 + }); + }); + + modelBuilder.Entity("Distribution.Models.ChequeBook", b => + { + b.HasOne("Distribution.Models.BankAccount", "BankAccount") + .WithMany() + .HasForeignKey("FK_BankAccountId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("BankAccount"); + }); + + modelBuilder.Entity("Distribution.Models.ChequePage", b => + { + b.HasOne("Distribution.Models.ChequeBook", "ChequeBook") + .WithMany("Pages") + .HasForeignKey("FK_ChequeBookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChequeBook"); + }); + + modelBuilder.Entity("Distribution.Models.Claim", b => + { + b.HasOne("Distribution.Models.User", "AgencyUser") + .WithMany() + .HasForeignKey("FK_AgencyUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "SettledByUser") + .WithMany() + .HasForeignKey("SettledByUserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("AgencyUser"); + + b.Navigation("SettledByUser"); + }); + + modelBuilder.Entity("Distribution.Models.CreditNote", b => + { + b.HasOne("Distribution.Models.SaleReturn", "SaleReturn") + .WithMany() + .HasForeignKey("FK_SaleReturnId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("SaleReturn"); + }); + + modelBuilder.Entity("Distribution.Models.DeliveryRun", b => + { + b.HasOne("Distribution.Models.DriverProfile", "DriverProfile") + .WithMany() + .HasForeignKey("FK_DriverProfileId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.Vehicle", "Vehicle") + .WithMany() + .HasForeignKey("FK_VehicleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DriverProfile"); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("Distribution.Models.DeliveryTask", b => + { + b.HasOne("Distribution.Models.DeliveryRun", "Ride") + .WithMany() + .HasForeignKey("FK_RideId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ShopPO", "ShopPO") + .WithMany() + .HasForeignKey("FK_ShopPOId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Ride"); + + b.Navigation("ShopPO"); + }); + + modelBuilder.Entity("Distribution.Models.DriverProfile", b => + { + b.HasOne("Distribution.Models.User", "User") + .WithMany() + .HasForeignKey("FK_UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceipt", b => + { + b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("FK_PurchaseOrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Supplier", "Supplier") + .WithMany() + .HasForeignKey("FK_SupplierId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Warehouse", "Warehouse") + .WithMany() + .HasForeignKey("FK_WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PurchaseOrder"); + + b.Navigation("Supplier"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItem", b => + { + b.HasOne("Distribution.Models.GoodsReceipt", "GoodsReceipt") + .WithMany("Items") + .HasForeignKey("FK_GoodsReceiptId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.PurchaseOrderItem", "PurchaseOrderItem") + .WithMany() + .HasForeignKey("FK_PurchaseOrderItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("GoodsReceipt"); + + b.Navigation("Item"); + + b.Navigation("PurchaseOrderItem"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItemBatch", b => + { + b.HasOne("Distribution.Models.GoodsReceiptItem", "GoodsReceiptItem") + .WithMany("Batches") + .HasForeignKey("FK_GoodsReceiptItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ItemBatch", "ItemBatch") + .WithMany() + .HasForeignKey("FK_ItemBatchId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("GoodsReceiptItem"); + + b.Navigation("ItemBatch"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItemSerial", b => + { + b.HasOne("Distribution.Models.GoodsReceiptItem", "GoodsReceiptItem") + .WithMany("Serials") + .HasForeignKey("FK_GoodsReceiptItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ItemSerialNumber", "ItemSerialNumber") + .WithMany() + .HasForeignKey("FK_ItemSerialNumberId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("GoodsReceiptItem"); + + b.Navigation("ItemSerialNumber"); + }); + + modelBuilder.Entity("Distribution.Models.Invoice", b => + { + b.HasOne("Distribution.Models.ShopPO", "ShopPO") + .WithMany() + .HasForeignKey("FK_ShopPOId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ShopPO"); + }); + + modelBuilder.Entity("Distribution.Models.Item", b => + { + b.HasOne("Distribution.Models.Uom", "BaseUom") + .WithMany() + .HasForeignKey("FK_BaseUomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.Brand", "Brand") + .WithMany() + .HasForeignKey("FK_BrandId"); + + b.HasOne("Distribution.Models.Category", "Category") + .WithMany() + .HasForeignKey("FK_CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.SubCategory", "SubCategory") + .WithMany() + .HasForeignKey("FK_SubCategoryId"); + + b.Navigation("BaseUom"); + + b.Navigation("Brand"); + + b.Navigation("Category"); + + b.Navigation("SubCategory"); + }); + + modelBuilder.Entity("Distribution.Models.ItemBatch", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + }); + + modelBuilder.Entity("Distribution.Models.ItemSerialNumber", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheet", b => + { + b.HasOne("Distribution.Models.DeliveryRun", "Ride") + .WithMany() + .HasForeignKey("FK_RideId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Ride"); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheetItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.LoadingSheet", "LoadingSheet") + .WithMany("Items") + .HasForeignKey("FK_LoadingSheetId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ShopPOItem", "ShopPOItem") + .WithMany() + .HasForeignKey("FK_ShopPOItemId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("Distribution.Models.Warehouse", "Warehouse") + .WithMany() + .HasForeignKey("FK_WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("LoadingSheet"); + + b.Navigation("ShopPOItem"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheetOrder", b => + { + b.HasOne("Distribution.Models.LoadingSheet", "LoadingSheet") + .WithMany("Orders") + .HasForeignKey("FK_LoadingSheetId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ShopPO", "ShopPO") + .WithMany() + .HasForeignKey("FK_ShopPOId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LoadingSheet"); + + b.Navigation("ShopPO"); + }); + + modelBuilder.Entity("Distribution.Models.Payment", b => + { + b.HasOne("Distribution.Models.Invoice", "Invoice") + .WithMany("Payments") + .HasForeignKey("FK_InvoiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Invoice"); + }); + + modelBuilder.Entity("Distribution.Models.PriceList", b => + { + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId"); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("Distribution.Models.PriceListItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.PriceList", "PriceList") + .WithMany("Items") + .HasForeignKey("FK_PriceListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("PriceList"); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseOrder", b => + { + b.HasOne("Distribution.Models.Supplier", "Supplier") + .WithMany() + .HasForeignKey("FK_SupplierId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseOrderItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder") + .WithMany("Items") + .HasForeignKey("FK_PurchaseOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("PurchaseOrder"); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseReturn", b => + { + b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("FK_PurchaseOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PurchaseOrder"); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseReturnItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.PurchaseReturn", "PurchaseReturn") + .WithMany("Items") + .HasForeignKey("FK_PurchaseReturnId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("PurchaseReturn"); + }); + + modelBuilder.Entity("Distribution.Models.ReceivedCheque", b => + { + b.HasOne("Distribution.Models.BankAccount", "DepositBankAccount") + .WithMany() + .HasForeignKey("FK_DepositBankAccountId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("DepositBankAccount"); + }); + + modelBuilder.Entity("Distribution.Models.RegionAgencyMap", b => + { + b.HasOne("Distribution.Models.User", "AgencyUser") + .WithMany() + .HasForeignKey("FK_AgencyUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AgencyUser"); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("Distribution.Models.RegionalBudget", b => + { + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("Distribution.Models.RegionalTarget", b => + { + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("Distribution.Models.RegionalTaxRule", b => + { + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("Distribution.Models.RolePermission", b => + { + b.HasOne("Distribution.Models.Permission", "Permission") + .WithMany() + .HasForeignKey("FK_PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.Role", "Role") + .WithMany() + .HasForeignKey("FK_RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Distribution.Models.Route", b => + { + b.HasOne("Distribution.Models.User", "OwnerUser") + .WithMany() + .HasForeignKey("FK_OwnerUserId"); + + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OwnerUser"); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("Distribution.Models.RouteVisitLog", b => + { + b.HasOne("Distribution.Models.Route", "Route") + .WithMany() + .HasForeignKey("FK_RouteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.Store", "Store") + .WithMany() + .HasForeignKey("FK_StoreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "User") + .WithMany() + .HasForeignKey("FK_UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Route"); + + b.Navigation("Store"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Distribution.Models.SaleReturn", b => + { + b.HasOne("Distribution.Models.User", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedByUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ShopPO", "ShopPO") + .WithMany() + .HasForeignKey("FK_ShopPOId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CreatedByUser"); + + b.Navigation("ShopPO"); + }); + + modelBuilder.Entity("Distribution.Models.SaleReturnItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.SaleReturn", "SaleReturn") + .WithMany("Items") + .HasForeignKey("FK_SaleReturnId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("SaleReturn"); + }); + + modelBuilder.Entity("Distribution.Models.Scheme", b => + { + b.HasOne("Distribution.Models.Item", "FreeItem") + .WithMany() + .HasForeignKey("FK_FreeItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Item", "TriggerItem") + .WithMany() + .HasForeignKey("FK_TriggerItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId"); + + b.Navigation("FreeItem"); + + b.Navigation("Region"); + + b.Navigation("TriggerItem"); + }); + + modelBuilder.Entity("Distribution.Models.SchemeBundleComponent", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.Scheme", "Scheme") + .WithMany("BundleComponents") + .HasForeignKey("FK_SchemeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("Scheme"); + }); + + modelBuilder.Entity("Distribution.Models.SchemeRedemption", b => + { + b.HasOne("Distribution.Models.Item", "FreeItem") + .WithMany() + .HasForeignKey("FK_FreeItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Scheme", "Scheme") + .WithMany("Redemptions") + .HasForeignKey("FK_SchemeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ShopPO", "ShopPO") + .WithMany() + .HasForeignKey("FK_ShopPOId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("FreeItem"); + + b.Navigation("Scheme"); + + b.Navigation("ShopPO"); + }); + + modelBuilder.Entity("Distribution.Models.ShopPO", b => + { + b.HasOne("Distribution.Models.Store", "Store") + .WithMany() + .HasForeignKey("FK_StoreId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Store"); + }); + + modelBuilder.Entity("Distribution.Models.ShopPOItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.ShopPO", "ShopPO") + .WithMany("Items") + .HasForeignKey("FK_ShopPOId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("ShopPO"); + }); + + modelBuilder.Entity("Distribution.Models.StockBalance", b => + { + b.HasOne("Distribution.Models.ItemBatch", "ItemBatch") + .WithMany() + .HasForeignKey("FK_ItemBatchId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.ItemSerialNumber", "ItemSerialNumber") + .WithMany() + .HasForeignKey("FK_ItemSerialNumberId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Item"); + + b.Navigation("ItemBatch"); + + b.Navigation("ItemSerialNumber"); + }); + + modelBuilder.Entity("Distribution.Models.StockMovement", b => + { + b.HasOne("Distribution.Models.ItemBatch", "ItemBatch") + .WithMany() + .HasForeignKey("FK_ItemBatchId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.ItemSerialNumber", "ItemSerialNumber") + .WithMany() + .HasForeignKey("FK_ItemSerialNumberId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Item"); + + b.Navigation("ItemBatch"); + + b.Navigation("ItemSerialNumber"); + }); + + modelBuilder.Entity("Distribution.Models.Store", b => + { + b.HasOne("Distribution.Models.Route", "Route") + .WithMany() + .HasForeignKey("FK_RouteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Route"); + }); + + modelBuilder.Entity("Distribution.Models.SubCategory", b => + { + b.HasOne("Distribution.Models.Category", "Category") + .WithMany() + .HasForeignKey("FK_CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Distribution.Models.SupplierClaim", b => + { + b.HasOne("Distribution.Models.GoodsReceipt", "GoodsReceipt") + .WithMany() + .HasForeignKey("FK_GoodsReceiptId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("FK_PurchaseOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "RaisedByUser") + .WithMany() + .HasForeignKey("RaisedByUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "ResolvedByUser") + .WithMany() + .HasForeignKey("ResolvedByUserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("GoodsReceipt"); + + b.Navigation("PurchaseOrder"); + + b.Navigation("RaisedByUser"); + + b.Navigation("ResolvedByUser"); + }); + + modelBuilder.Entity("Distribution.Models.SupplierClaimItem", b => + { + b.HasOne("Distribution.Models.Item", "Item") + .WithMany() + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Distribution.Models.SupplierClaim", "SupplierClaim") + .WithMany("Items") + .HasForeignKey("FK_SupplierClaimId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Item"); + + b.Navigation("SupplierClaim"); + }); + + modelBuilder.Entity("Distribution.Models.UomConversion", b => + { + b.HasOne("Distribution.Models.Uom", "FromUom") + .WithMany() + .HasForeignKey("FK_FromUomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.Item", "Item") + .WithMany("Conversions") + .HasForeignKey("FK_ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.Uom", "ToUom") + .WithMany() + .HasForeignKey("FK_ToUomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FromUom"); + + b.Navigation("Item"); + + b.Navigation("ToUom"); + }); + + modelBuilder.Entity("Distribution.Models.User", b => + { + b.HasOne("Distribution.Models.User", "ReportsTo") + .WithMany() + .HasForeignKey("FK_ReportsToUserId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Distribution.Models.Role", "Role") + .WithMany() + .HasForeignKey("FK_RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ReportsTo"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Distribution.Models.UserRegionScope", b => + { + b.HasOne("Distribution.Models.Region", "Region") + .WithMany() + .HasForeignKey("FK_RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "User") + .WithMany() + .HasForeignKey("FK_UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Distribution.Models.UserRouteScope", b => + { + b.HasOne("Distribution.Models.Route", "Route") + .WithMany() + .HasForeignKey("FK_RouteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "User") + .WithMany() + .HasForeignKey("FK_UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Route"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Distribution.Models.UserStoreScope", b => + { + b.HasOne("Distribution.Models.Store", "Store") + .WithMany() + .HasForeignKey("FK_StoreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Distribution.Models.User", "User") + .WithMany() + .HasForeignKey("FK_UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Store"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Distribution.Models.Vehicle", b => + { + b.HasOne("Distribution.Models.Warehouse", null) + .WithMany() + .HasForeignKey("DefaultWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Distribution.Models.Warehouse", b => + { + b.HasOne("Distribution.Models.Vehicle", "Vehicle") + .WithMany() + .HasForeignKey("VehicleId"); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("Distribution.Models.ChequeBook", b => + { + b.Navigation("Pages"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceipt", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Distribution.Models.GoodsReceiptItem", b => + { + b.Navigation("Batches"); + + b.Navigation("Serials"); + }); + + modelBuilder.Entity("Distribution.Models.Invoice", b => + { + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Distribution.Models.Item", b => + { + b.Navigation("Conversions"); + }); + + modelBuilder.Entity("Distribution.Models.LoadingSheet", b => + { + b.Navigation("Items"); + + b.Navigation("Orders"); + }); + + modelBuilder.Entity("Distribution.Models.PriceList", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseOrder", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Distribution.Models.PurchaseReturn", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Distribution.Models.SaleReturn", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Distribution.Models.Scheme", b => + { + b.Navigation("BundleComponents"); + + b.Navigation("Redemptions"); + }); + + modelBuilder.Entity("Distribution.Models.ShopPO", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("Distribution.Models.SupplierClaim", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Distribution/Migrations/20261019111029_SeedDefaultCashAccount.cs b/Distribution/Migrations/20261019111029_SeedDefaultCashAccount.cs new file mode 100644 index 0000000..54eee61 --- /dev/null +++ b/Distribution/Migrations/20261019111029_SeedDefaultCashAccount.cs @@ -0,0 +1,729 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Distribution.Migrations +{ + /// + public partial class SeedDefaultCashAccount : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "BankAccounts", + columns: new[] { "Id", "AccountName", "AccountNumber", "AccountType", "BankName", "CashAccountTypeName", "CreatedAt", "CurrencyCode", "IsActive", "IsDefault" }, + values: new object[] { new Guid("11111111-1111-1111-1111-000000000001"), "Petty Cash", null, 0, null, "Petty Cash", new DateTime(2026, 10, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "LKR", true, true }); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("ec13fdfa-d848-4004-b749-4b455ba0a77e")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000002"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("66f41359-cf33-4bd9-a936-816f03b23da7")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000003"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("369efbe7-f200-4b2e-bc15-858b6d2ca882")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000004"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("adc14999-08af-4b4c-937d-3ecd7c35b709")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000005"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("f1bf4ccb-45c6-4915-b941-6b507eb1e44f")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000006"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("1cbd132a-ea3d-46b2-8150-c5a077b6b36a")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000007"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("362118bd-1d4c-4576-95f6-7da899bf7368")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000008"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("15e94675-d2ae-4f5a-8198-6297a26d7a2c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000009"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("4af2ab93-d3ba-4bda-b440-167f672cc166")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000010"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("bc5ba5f8-f20a-432a-985b-95b9500ce693")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000011"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("4f43f82b-8e6a-4729-9ded-c78c7dde24a7")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000012"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("7ac3df8c-f5c3-4d57-b537-5d5ca4ec1e11")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000013"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("44ec8d0f-f540-4786-9d9a-9194fa091286")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000014"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("143c4280-21be-4852-adc5-7cd17ab595fd")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000015"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("d00b144e-bf2d-4a04-9c85-0c14544edf48")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000016"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("9a72b7e4-1197-4032-8ec6-ebb3442a267f")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000017"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("5ec2af6e-d1db-4811-9c37-94a260e6ef9b")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000018"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("a71aceba-5199-4824-8b4e-998b108c082c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000019"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("4bd840bf-da52-46fd-b065-40253f915c7c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000020"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("8b4d8558-dba9-45bb-b263-f066580a55e9")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000021"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("0ee1a2e0-e4d2-4af3-9cca-ffad05bc1e20")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000022"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("700be5ec-0c11-497b-808a-80e7a854d2b4")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000023"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("b9978e5a-14b1-462a-9b7b-c9c32c4decb9")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000024"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("1e7cc9d4-f65e-434b-90e5-f78b4fda39b8")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000025"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("bfb3f80b-32c3-43b0-b216-f05e55f09360")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000026"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("fcfe2242-93ad-4c6d-8eec-3ec1f1270d0a")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000027"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("8e6eeb90-966f-4417-a1ae-148cdaa64904")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000028"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("6df60aea-63f3-465e-96fb-9a7304ead3c2")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000029"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("c0e21519-a095-4c7f-af42-e26efdcdd31e")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000030"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("496bbf8d-d84d-4c21-b190-bf95a06b4113")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000031"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("36f55476-d749-459b-92d9-839919499460")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000032"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("d90301fa-8990-49cf-8fa0-228ea7e684bc")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000033"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("8da4cd2a-1fd2-4417-bb6d-9e91174193f5")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000034"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("cc9bed46-a230-4611-88b4-d568abca857e")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000035"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("4d791413-ac44-4165-87b8-c28dbfa49230")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000036"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("2bb28028-8b12-4937-9dc6-68e35b100007")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000037"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("fdc8d3d9-a32d-4322-8144-93ff677beea3")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000038"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("b1ea0901-08e8-4dea-8ac3-15b522a2f274")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000039"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("116ac7bf-741e-4d4f-a313-2e7946a50044")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000040"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("7fd97ca6-a14b-4e42-8474-5471c0ef79a9")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000041"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("e58f35b2-8308-4fbb-b3ca-db9d037347cd")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000042"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("dc6b2750-083b-4653-a986-7af7aaec8136")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000043"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("6629888a-eb6b-433f-bbfe-ee5d947fb5b2")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000044"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("94b97271-7593-4cec-9290-802e9a26f0d8")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000045"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("0dc88aca-4e86-4712-988f-8db6a466531d")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000046"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("c8839187-4358-4218-bf3d-5ea4ed758661")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000047"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("5c731906-8d81-4f85-abad-230050af0bd0")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000048"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("d6e3db40-ca38-4caf-88d8-ce87475b4d87")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000049"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("398f1c4d-5d7d-4af4-9aa7-a88d7abf9a33")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000050"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("0f6c66e6-833c-4b52-ba2c-09da8dbead6f")); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "BankAccounts", + keyColumn: "Id", + keyValue: new Guid("11111111-1111-1111-1111-000000000001")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("8c43c584-0f65-496d-a77c-a7df46bb175d")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000002"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("25576a9d-38cb-4ff5-b8ca-08df43d8a5a6")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000003"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("e47016c1-a014-476f-ba87-4b3d438de62a")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000004"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("a24c0e9e-0194-4f96-823c-bdbdcd122d85")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000005"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("e76ef6e2-67ba-462f-a954-b1dbc5a95d8c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000006"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("bba4fdaa-fd0e-43dc-aedf-331212bd06cd")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000007"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("bc66d450-af6b-426e-9d05-266ceba21fac")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000008"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("9ee2196c-1e4b-452d-aaf6-7c55e3d2be2b")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000009"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("63508590-7a30-4640-9fc9-d3d54978f581")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000010"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("82802a3f-23bc-45db-a531-d7e880dd7970")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000011"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("65ccf5b6-754a-431a-81bf-d8e0587c956e")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000012"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("6c713413-362b-475a-846b-9f3382cf7a35")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000013"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("6dfe68ff-f5a3-41a8-981b-ac108a81408e")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000014"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("09c6b812-dc14-44a2-9362-429dfef3942d")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000015"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("bf29a1bb-234e-47a3-922f-f0fb3a1daba0")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000016"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("0d2f3497-4852-453e-a451-275e945b6c1d")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000017"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("41c13dbc-4f51-4134-891c-b6955f728d65")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000018"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("29bc0291-7a91-4fc5-840b-9420b64b86fc")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000019"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("8ae0c386-d206-4580-890f-c1673c1dfeb2")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000020"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("5db4bd09-9481-4608-9dec-3412ba7f3f69")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000021"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("c1840bd7-88fd-496a-8d88-aef3d886e1ec")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000022"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("af97d659-c040-4fdc-beeb-62fc8334f95c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000023"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("a6443517-3c2a-4407-a3bd-5497e053b0d6")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000024"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("2f540d56-bff4-41fe-9181-4a423c1da51c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000025"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("db18cfb8-a56c-46bc-baff-298e6204c455")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000026"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("fe209c12-1189-485b-920e-ce6db3c132b9")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000027"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("fedef395-394d-4237-b5aa-8254603ed304")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000028"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("7cc47626-65b8-44b0-83fb-a5dff96c39f6")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000029"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("cf04aea5-3f47-4717-95aa-8dab547f9cfb")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000030"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("c2906d62-9eea-4d08-b904-86a3f8b04a20")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000031"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("7a546bf9-c2f3-4d23-a38e-a068da53dfeb")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000032"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("19c916c3-7b17-42e0-b4b6-89b8cb6475f4")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000033"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("e6805dbe-a931-4e2a-b08f-83e8760d4968")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000034"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("7d991f5c-16db-46c5-863c-93063c2e7382")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000035"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("513c50d0-5d7b-426d-beef-f14bdea626bc")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000036"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("638a6a60-25da-425c-bdec-683431c26d62")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000037"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("b00bfae6-92bb-48cb-99d9-f2814baae47d")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000038"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("6562c9b4-0673-4ce0-8805-03734bc889ce")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000039"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("6601e0fe-83dd-4307-be91-38dae998cc9c")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000040"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("c4848449-9678-4fa6-8a00-db4e504b57d6")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000041"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("91c02c24-12a3-48d5-9d19-174c8e764152")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000042"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("0f00477f-5120-40ba-a0e6-0406e47d1c80")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000043"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("db135a10-6335-478d-b2f8-3b5934cd142b")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000044"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("5c219dd9-9ff3-4541-a708-cc7e4bd4dd25")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000045"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("086e7b93-079d-49d0-90e9-95899b53be52")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000046"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("f0b3d172-cb32-4606-8272-00feaf4067a2")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000047"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("75a882c0-b2e9-4efa-a64c-b5d530d42194")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000048"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("03540f63-d811-4436-869f-2f76995bbb19")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000049"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("73894d9f-a823-4b5b-b809-5cc0aa716a70")); + + migrationBuilder.UpdateData( + table: "RolePermissions", + keyColumns: new[] { "FK_PermissionId", "FK_RoleId" }, + keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000050"), new Guid("10000000-0000-0000-0000-000000000007") }, + column: "Id", + value: new Guid("1ad4bfb8-cde6-4623-a21d-9a78af0026d6")); + } + } +} diff --git a/Distribution/Migrations/AppDBContextModelSnapshot.cs b/Distribution/Migrations/AppDBContextModelSnapshot.cs index 658e3dc..c11082f 100644 --- a/Distribution/Migrations/AppDBContextModelSnapshot.cs +++ b/Distribution/Migrations/AppDBContextModelSnapshot.cs @@ -68,6 +68,19 @@ namespace Distribution.Migrations .IsUnique(); b.ToTable("BankAccounts"); + + b.HasData( + new + { + Id = new Guid("11111111-1111-1111-1111-000000000001"), + AccountName = "Petty Cash", + AccountType = 0, + CashAccountTypeName = "Petty Cash", + CreatedAt = new DateTime(2026, 10, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), + CurrencyCode = "LKR", + IsActive = true, + IsDefault = true + }); }); modelBuilder.Entity("Distribution.Models.Brand", b => @@ -2505,7 +2518,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000001"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("8c43c584-0f65-496d-a77c-a7df46bb175d"), + Id = new Guid("ec13fdfa-d848-4004-b749-4b455ba0a77e"), IsActive = true }, new @@ -2513,7 +2526,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000002"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("25576a9d-38cb-4ff5-b8ca-08df43d8a5a6"), + Id = new Guid("66f41359-cf33-4bd9-a936-816f03b23da7"), IsActive = true }, new @@ -2521,7 +2534,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000003"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("e47016c1-a014-476f-ba87-4b3d438de62a"), + Id = new Guid("369efbe7-f200-4b2e-bc15-858b6d2ca882"), IsActive = true }, new @@ -2529,7 +2542,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000004"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("a24c0e9e-0194-4f96-823c-bdbdcd122d85"), + Id = new Guid("adc14999-08af-4b4c-937d-3ecd7c35b709"), IsActive = true }, new @@ -2537,7 +2550,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000005"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("e76ef6e2-67ba-462f-a954-b1dbc5a95d8c"), + Id = new Guid("f1bf4ccb-45c6-4915-b941-6b507eb1e44f"), IsActive = true }, new @@ -2545,7 +2558,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000006"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("bba4fdaa-fd0e-43dc-aedf-331212bd06cd"), + Id = new Guid("1cbd132a-ea3d-46b2-8150-c5a077b6b36a"), IsActive = true }, new @@ -2553,7 +2566,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000007"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("bc66d450-af6b-426e-9d05-266ceba21fac"), + Id = new Guid("362118bd-1d4c-4576-95f6-7da899bf7368"), IsActive = true }, new @@ -2561,7 +2574,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000008"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("9ee2196c-1e4b-452d-aaf6-7c55e3d2be2b"), + Id = new Guid("15e94675-d2ae-4f5a-8198-6297a26d7a2c"), IsActive = true }, new @@ -2569,7 +2582,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000009"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("63508590-7a30-4640-9fc9-d3d54978f581"), + Id = new Guid("4af2ab93-d3ba-4bda-b440-167f672cc166"), IsActive = true }, new @@ -2577,7 +2590,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000010"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("82802a3f-23bc-45db-a531-d7e880dd7970"), + Id = new Guid("bc5ba5f8-f20a-432a-985b-95b9500ce693"), IsActive = true }, new @@ -2585,7 +2598,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000011"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("65ccf5b6-754a-431a-81bf-d8e0587c956e"), + Id = new Guid("4f43f82b-8e6a-4729-9ded-c78c7dde24a7"), IsActive = true }, new @@ -2593,7 +2606,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000012"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("6c713413-362b-475a-846b-9f3382cf7a35"), + Id = new Guid("7ac3df8c-f5c3-4d57-b537-5d5ca4ec1e11"), IsActive = true }, new @@ -2601,7 +2614,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000013"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("6dfe68ff-f5a3-41a8-981b-ac108a81408e"), + Id = new Guid("44ec8d0f-f540-4786-9d9a-9194fa091286"), IsActive = true }, new @@ -2609,7 +2622,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000014"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("09c6b812-dc14-44a2-9362-429dfef3942d"), + Id = new Guid("143c4280-21be-4852-adc5-7cd17ab595fd"), IsActive = true }, new @@ -2617,7 +2630,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000015"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("bf29a1bb-234e-47a3-922f-f0fb3a1daba0"), + Id = new Guid("d00b144e-bf2d-4a04-9c85-0c14544edf48"), IsActive = true }, new @@ -2625,7 +2638,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000016"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("0d2f3497-4852-453e-a451-275e945b6c1d"), + Id = new Guid("9a72b7e4-1197-4032-8ec6-ebb3442a267f"), IsActive = true }, new @@ -2633,7 +2646,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000017"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("41c13dbc-4f51-4134-891c-b6955f728d65"), + Id = new Guid("5ec2af6e-d1db-4811-9c37-94a260e6ef9b"), IsActive = true }, new @@ -2641,7 +2654,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000018"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("29bc0291-7a91-4fc5-840b-9420b64b86fc"), + Id = new Guid("a71aceba-5199-4824-8b4e-998b108c082c"), IsActive = true }, new @@ -2649,7 +2662,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000019"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("8ae0c386-d206-4580-890f-c1673c1dfeb2"), + Id = new Guid("4bd840bf-da52-46fd-b065-40253f915c7c"), IsActive = true }, new @@ -2657,7 +2670,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000020"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("5db4bd09-9481-4608-9dec-3412ba7f3f69"), + Id = new Guid("8b4d8558-dba9-45bb-b263-f066580a55e9"), IsActive = true }, new @@ -2665,7 +2678,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000021"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("c1840bd7-88fd-496a-8d88-aef3d886e1ec"), + Id = new Guid("0ee1a2e0-e4d2-4af3-9cca-ffad05bc1e20"), IsActive = true }, new @@ -2673,7 +2686,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000022"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("af97d659-c040-4fdc-beeb-62fc8334f95c"), + Id = new Guid("700be5ec-0c11-497b-808a-80e7a854d2b4"), IsActive = true }, new @@ -2681,7 +2694,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000023"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("a6443517-3c2a-4407-a3bd-5497e053b0d6"), + Id = new Guid("b9978e5a-14b1-462a-9b7b-c9c32c4decb9"), IsActive = true }, new @@ -2689,7 +2702,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000024"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("2f540d56-bff4-41fe-9181-4a423c1da51c"), + Id = new Guid("1e7cc9d4-f65e-434b-90e5-f78b4fda39b8"), IsActive = true }, new @@ -2697,7 +2710,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000025"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("db18cfb8-a56c-46bc-baff-298e6204c455"), + Id = new Guid("bfb3f80b-32c3-43b0-b216-f05e55f09360"), IsActive = true }, new @@ -2705,7 +2718,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000026"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("fe209c12-1189-485b-920e-ce6db3c132b9"), + Id = new Guid("fcfe2242-93ad-4c6d-8eec-3ec1f1270d0a"), IsActive = true }, new @@ -2713,7 +2726,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000027"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("fedef395-394d-4237-b5aa-8254603ed304"), + Id = new Guid("8e6eeb90-966f-4417-a1ae-148cdaa64904"), IsActive = true }, new @@ -2721,7 +2734,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000028"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("7cc47626-65b8-44b0-83fb-a5dff96c39f6"), + Id = new Guid("6df60aea-63f3-465e-96fb-9a7304ead3c2"), IsActive = true }, new @@ -2729,7 +2742,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000029"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("cf04aea5-3f47-4717-95aa-8dab547f9cfb"), + Id = new Guid("c0e21519-a095-4c7f-af42-e26efdcdd31e"), IsActive = true }, new @@ -2737,7 +2750,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000030"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("c2906d62-9eea-4d08-b904-86a3f8b04a20"), + Id = new Guid("496bbf8d-d84d-4c21-b190-bf95a06b4113"), IsActive = true }, new @@ -2745,7 +2758,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000031"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("7a546bf9-c2f3-4d23-a38e-a068da53dfeb"), + Id = new Guid("36f55476-d749-459b-92d9-839919499460"), IsActive = true }, new @@ -2753,7 +2766,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000032"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("19c916c3-7b17-42e0-b4b6-89b8cb6475f4"), + Id = new Guid("d90301fa-8990-49cf-8fa0-228ea7e684bc"), IsActive = true }, new @@ -2761,7 +2774,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000033"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("e6805dbe-a931-4e2a-b08f-83e8760d4968"), + Id = new Guid("8da4cd2a-1fd2-4417-bb6d-9e91174193f5"), IsActive = true }, new @@ -2769,7 +2782,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000034"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("7d991f5c-16db-46c5-863c-93063c2e7382"), + Id = new Guid("cc9bed46-a230-4611-88b4-d568abca857e"), IsActive = true }, new @@ -2777,7 +2790,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000035"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("513c50d0-5d7b-426d-beef-f14bdea626bc"), + Id = new Guid("4d791413-ac44-4165-87b8-c28dbfa49230"), IsActive = true }, new @@ -2785,7 +2798,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000036"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("638a6a60-25da-425c-bdec-683431c26d62"), + Id = new Guid("2bb28028-8b12-4937-9dc6-68e35b100007"), IsActive = true }, new @@ -2793,7 +2806,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000037"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("b00bfae6-92bb-48cb-99d9-f2814baae47d"), + Id = new Guid("fdc8d3d9-a32d-4322-8144-93ff677beea3"), IsActive = true }, new @@ -2801,7 +2814,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000038"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("6562c9b4-0673-4ce0-8805-03734bc889ce"), + Id = new Guid("b1ea0901-08e8-4dea-8ac3-15b522a2f274"), IsActive = true }, new @@ -2809,7 +2822,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000039"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("6601e0fe-83dd-4307-be91-38dae998cc9c"), + Id = new Guid("116ac7bf-741e-4d4f-a313-2e7946a50044"), IsActive = true }, new @@ -2817,7 +2830,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000040"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("c4848449-9678-4fa6-8a00-db4e504b57d6"), + Id = new Guid("7fd97ca6-a14b-4e42-8474-5471c0ef79a9"), IsActive = true }, new @@ -2825,7 +2838,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000041"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("91c02c24-12a3-48d5-9d19-174c8e764152"), + Id = new Guid("e58f35b2-8308-4fbb-b3ca-db9d037347cd"), IsActive = true }, new @@ -2833,7 +2846,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000042"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("0f00477f-5120-40ba-a0e6-0406e47d1c80"), + Id = new Guid("dc6b2750-083b-4653-a986-7af7aaec8136"), IsActive = true }, new @@ -2841,7 +2854,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000043"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("db135a10-6335-478d-b2f8-3b5934cd142b"), + Id = new Guid("6629888a-eb6b-433f-bbfe-ee5d947fb5b2"), IsActive = true }, new @@ -2849,7 +2862,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000044"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("5c219dd9-9ff3-4541-a708-cc7e4bd4dd25"), + Id = new Guid("94b97271-7593-4cec-9290-802e9a26f0d8"), IsActive = true }, new @@ -2857,7 +2870,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000045"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("086e7b93-079d-49d0-90e9-95899b53be52"), + Id = new Guid("0dc88aca-4e86-4712-988f-8db6a466531d"), IsActive = true }, new @@ -2865,7 +2878,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000046"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("f0b3d172-cb32-4606-8272-00feaf4067a2"), + Id = new Guid("c8839187-4358-4218-bf3d-5ea4ed758661"), IsActive = true }, new @@ -2873,7 +2886,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000047"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("75a882c0-b2e9-4efa-a64c-b5d530d42194"), + Id = new Guid("5c731906-8d81-4f85-abad-230050af0bd0"), IsActive = true }, new @@ -2881,7 +2894,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000048"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("03540f63-d811-4436-869f-2f76995bbb19"), + Id = new Guid("d6e3db40-ca38-4caf-88d8-ce87475b4d87"), IsActive = true }, new @@ -2889,7 +2902,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000049"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("73894d9f-a823-4b5b-b809-5cc0aa716a70"), + Id = new Guid("398f1c4d-5d7d-4af4-9aa7-a88d7abf9a33"), IsActive = true }, new @@ -2897,7 +2910,7 @@ namespace Distribution.Migrations FK_RoleId = new Guid("10000000-0000-0000-0000-000000000007"), FK_PermissionId = new Guid("20000000-0000-0000-0000-000000000050"), CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), - Id = new Guid("1ad4bfb8-cde6-4623-a21d-9a78af0026d6"), + Id = new Guid("0f6c66e6-833c-4b52-ba2c-09da8dbead6f"), IsActive = true }); }); -- 2.52.0