// <auto-generated />
using System;
using ERPCore.Infra.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace ERPCore.Migrations
{
    [DbContext(typeof(ErpDbContext))]
    [Migration("20260816142234_AddAdjustmentGlPosting")]
    partial class AddAdjustmentGlPosting
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "10.0.9")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b =>
                {
                    b.Property<int>("AttendanceRecordId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AttendanceRecordId"));

                    b.Property<DateTime>("AttendanceDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("AttendanceStatus")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int?>("AttendanceUploadBatchId")
                        .HasColumnType("integer");

                    b.Property<TimeSpan?>("CheckIn")
                        .HasColumnType("interval");

                    b.Property<TimeSpan?>("CheckOut")
                        .HasColumnType("interval");

                    b.Property<int?>("DuplicateOfAttendanceRecordId")
                        .HasColumnType("integer");

                    b.Property<int>("EarlyLeaveMinutes")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("EditedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("EditedBy")
                        .HasColumnType("integer");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<bool>("IsManualOverride")
                        .HasColumnType("boolean");

                    b.Property<int>("LateMinutes")
                        .HasColumnType("integer");

                    b.Property<string>("Notes")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)");

                    b.Property<int>("OvertimeMinutes")
                        .HasColumnType("integer");

                    b.Property<string>("RowValidationStatus")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("WorkShiftId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkingMinutes")
                        .HasColumnType("integer");

                    b.HasKey("AttendanceRecordId");

                    b.HasIndex("AttendanceUploadBatchId");

                    b.HasIndex("WorkShiftId");

                    b.HasIndex("EmployeeId", "AttendanceDate");

                    b.ToTable("hr_attendance_records", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b =>
                {
                    b.Property<int>("AttendanceUploadBatchId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AttendanceUploadBatchId"));

                    b.Property<DateTime?>("ConfirmedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("ConfirmedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("OriginalFileName")
                        .HasMaxLength(260)
                        .HasColumnType("character varying(260)");

                    b.Property<DateTime>("PeriodEnd")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime>("PeriodStart")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("RowCountDuplicate")
                        .HasColumnType("integer");

                    b.Property<int>("RowCountError")
                        .HasColumnType("integer");

                    b.Property<int>("RowCountTotal")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("SourceType")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("UploadedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("UploadedBy")
                        .HasColumnType("integer");

                    b.HasKey("AttendanceUploadBatchId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.HasIndex("PeriodStart", "PeriodEnd");

                    b.ToTable("hr_attendance_upload_batches", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b =>
                {
                    b.Property<int>("AuditId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AuditId"));

                    b.Property<string>("Action")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)");

                    b.Property<string>("ChangeSet")
                        .IsRequired()
                        .HasColumnType("jsonb");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("EntityId")
                        .HasColumnType("integer");

                    b.Property<string>("EntityType")
                        .IsRequired()
                        .HasMaxLength(80)
                        .HasColumnType("character varying(80)");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("AuditId");

                    b.HasIndex("CreatedAt");

                    b.HasIndex("UserId");

                    b.HasIndex("EntityType", "EntityId");

                    b.ToTable("audit_logs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b =>
                {
                    b.Property<int>("BatchId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BatchId"));

                    b.Property<string>("BatchNo")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<DateOnly?>("ExpiryDate")
                        .HasColumnType("date");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.HasKey("BatchId");

                    b.HasIndex("ItemId", "BatchNo")
                        .IsUnique();

                    b.ToTable("batches", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b =>
                {
                    b.Property<int>("BinId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BinId"));

                    b.Property<string>("BinType")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("BinId");

                    b.HasIndex("WarehouseId", "Code")
                        .IsUnique();

                    b.ToTable("bins", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b =>
                {
                    b.Property<int>("BranchId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BranchId"));

                    b.Property<string>("Address")
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("BranchId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_branches", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b =>
                {
                    b.Property<int>("BrandId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BrandId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("BrandId");

                    b.HasIndex("Name")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("brands", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b =>
                {
                    b.Property<int>("BundleSaleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BundleSaleId"));

                    b.Property<string>("BundleCode")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<DateTime>("BundleDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("BundleName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("BundleNo")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<decimal>("BundlePrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("BundleSaleTemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("CashierUserId")
                        .HasColumnType("integer");

                    b.Property<decimal>("ComponentSubtotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasDefaultValue(0);

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CustomerId")
                        .HasColumnType("integer");

                    b.Property<string>("CustomerSnapshotName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<decimal>("DiscountTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("GrandTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("MarginAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Draft");

                    b.Property<decimal>("TaxTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("BundleSaleId");

                    b.HasIndex("BundleNo")
                        .IsUnique();

                    b.HasIndex("BundleSaleTemplateId");

                    b.HasIndex("CashierUserId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("bundle_sales", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b =>
                {
                    b.Property<int>("BundleSaleLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BundleSaleLineId"));

                    b.Property<int>("BundleSaleId")
                        .HasColumnType("integer");

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<bool>("IncludeInBundle")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(true);

                    b.Property<bool>("IsComponent")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(true);

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("LineTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("ParentLineId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("UnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("BundleSaleLineId");

                    b.HasIndex("BundleSaleId");

                    b.HasIndex("ItemId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("bundle_sale_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b =>
                {
                    b.Property<int>("BundleSaleTemplateId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BundleSaleTemplateId"));

                    b.Property<int>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasDefaultValue(0);

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("TemplateCode")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("TemplateName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("BundleSaleTemplateId");

                    b.HasIndex("TemplateCode")
                        .IsUnique();

                    b.ToTable("bundle_sale_templates", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b =>
                {
                    b.Property<int>("BundleSaleTemplateLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BundleSaleTemplateLineId"));

                    b.Property<int>("BundleSaleTemplateId")
                        .HasColumnType("integer");

                    b.Property<bool>("IncludeInBundle")
                        .HasColumnType("boolean");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("SortOrder")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasDefaultValue(0);

                    b.Property<decimal>("UnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("BundleSaleTemplateLineId");

                    b.HasIndex("BundleSaleTemplateId");

                    b.HasIndex("ItemId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("bundle_sale_template_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Category", b =>
                {
                    b.Property<int>("CategoryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("CategoryId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("CategoryId");

                    b.HasIndex("Name")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("categories", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b =>
                {
                    b.Property<int>("CustomerId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("CustomerId"));

                    b.Property<string>("AddressLine1")
                        .HasMaxLength(250)
                        .HasColumnType("character varying(250)");

                    b.Property<string>("AddressLine2")
                        .HasMaxLength(250)
                        .HasColumnType("character varying(250)");

                    b.Property<string>("City")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<string>("Country")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreditDays")
                        .HasColumnType("integer");

                    b.Property<decimal>("CreditLimit")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("CustomerCode")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("CustomerType")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("B2C");

                    b.Property<int?>("DefaultWarehouseId")
                        .HasColumnType("integer");

                    b.Property<string>("DisplayName")
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("Email")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("Phone")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("TaxRegistrationNo")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("CustomerId");

                    b.HasIndex("CustomerCode")
                        .IsUnique();

                    b.HasIndex("CustomerType");

                    b.HasIndex("DefaultWarehouseId");

                    b.HasIndex("Status");

                    b.ToTable("customers", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Department", b =>
                {
                    b.Property<int>("DepartmentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("DepartmentId"));

                    b.Property<int?>("BranchId")
                        .HasColumnType("integer");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("HeadEmployeeId")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<int?>("ParentDepartmentId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("DepartmentId");

                    b.HasIndex("BranchId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("HeadEmployeeId");

                    b.HasIndex("ParentDepartmentId");

                    b.HasIndex("Status");

                    b.ToTable("hr_departments", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b =>
                {
                    b.Property<int>("DesignationId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("DesignationId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("DesignationId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_designations", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b =>
                {
                    b.Property<int>("EmployeeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmployeeId"));

                    b.Property<string>("AddressLine1")
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("AddressLine2")
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<int?>("BranchId")
                        .HasColumnType("integer");

                    b.Property<string>("City")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<DateTime?>("ConfirmationDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Country")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("DateOfBirth")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("DepartmentId")
                        .HasColumnType("integer");

                    b.Property<int>("DesignationId")
                        .HasColumnType("integer");

                    b.Property<string>("Email")
                        .HasMaxLength(320)
                        .HasColumnType("character varying(320)");

                    b.Property<string>("EmergencyContactName")
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("EmergencyContactPhone")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("EmergencyContactRelationship")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<string>("EmployeeCode")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int>("EmploymentTypeId")
                        .HasColumnType("integer");

                    b.Property<string>("EpfNumber")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("EtfNumber")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("FullName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("Gender")
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("HireDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime?>("LastWorkingDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Nationality")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<string>("Nic")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("PersonalMobile")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("PostalCode")
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("ProfilePhotoPath")
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)");

                    b.Property<int?>("ReportingManagerId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("TaxIdentificationNumber")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("UpdatedBy")
                        .HasColumnType("integer");

                    b.Property<int?>("UserId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkShiftId")
                        .HasColumnType("integer");

                    b.HasKey("EmployeeId");

                    b.HasIndex("BranchId");

                    b.HasIndex("DepartmentId");

                    b.HasIndex("DesignationId");

                    b.HasIndex("Email");

                    b.HasIndex("EmployeeCode")
                        .IsUnique();

                    b.HasIndex("EmploymentTypeId");

                    b.HasIndex("ReportingManagerId");

                    b.HasIndex("Status");

                    b.HasIndex("UserId")
                        .IsUnique();

                    b.HasIndex("WorkShiftId");

                    b.ToTable("hr_employees", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b =>
                {
                    b.Property<int>("EmployeeBankDetailId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmployeeBankDetailId"));

                    b.Property<string>("AccountHolderName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("AccountNumber")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("BankName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("BranchName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<bool>("IsPrimary")
                        .HasColumnType("boolean");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("SwiftCode")
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("EmployeeBankDetailId");

                    b.HasIndex("EmployeeId");

                    b.ToTable("hr_employee_bank_details", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b =>
                {
                    b.Property<int>("EmployeeDocumentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmployeeDocumentId"));

                    b.Property<string>("ContentType")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("ExpiryDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("HrDocumentTypeId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("IssueDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Notes")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)");

                    b.Property<string>("OriginalFileName")
                        .IsRequired()
                        .HasMaxLength(260)
                        .HasColumnType("character varying(260)");

                    b.Property<string>("RelativePath")
                        .IsRequired()
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<long>("SizeBytes")
                        .HasColumnType("bigint");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("StoredFileName")
                        .IsRequired()
                        .HasMaxLength(260)
                        .HasColumnType("character varying(260)");

                    b.Property<DateTime>("UploadedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("UploadedBy")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("VerifiedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("VerifiedBy")
                        .HasColumnType("integer");

                    b.HasKey("EmployeeDocumentId");

                    b.HasIndex("EmployeeId");

                    b.HasIndex("ExpiryDate");

                    b.HasIndex("HrDocumentTypeId");

                    b.ToTable("hr_employee_documents", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b =>
                {
                    b.Property<int>("EmployeeLoanId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmployeeLoanId"));

                    b.Property<DateTime>("ApprovedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("ApprovedBy")
                        .HasColumnType("integer");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<decimal>("InstallmentAmount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("InterestRate")
                        .HasPrecision(6, 4)
                        .HasColumnType("numeric(6,4)");

                    b.Property<string>("LoanKind")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("NumberOfInstallments")
                        .HasColumnType("integer");

                    b.Property<decimal>("OutstandingBalance")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("PrincipalAmount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("StartMonth")
                        .HasColumnType("integer");

                    b.Property<int>("StartYear")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("EmployeeLoanId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("EmployeeId");

                    b.HasIndex("Status");

                    b.ToTable("hr_employee_loans", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b =>
                {
                    b.Property<int>("EmployeeSalaryStructureId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmployeeSalaryStructureId"));

                    b.Property<DateTime>("ApprovedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("ApprovedBy")
                        .HasColumnType("integer");

                    b.Property<decimal>("BasicSalary")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("Currency")
                        .IsRequired()
                        .HasMaxLength(3)
                        .HasColumnType("character varying(3)");

                    b.Property<DateTime>("EffectiveFrom")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime?>("EffectiveTo")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("EmployeeSalaryStructureId");

                    b.HasIndex("EmployeeId", "EffectiveTo");

                    b.ToTable("hr_employee_salary_structures", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b =>
                {
                    b.Property<int>("EmployeeSalaryStructureLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmployeeSalaryStructureLineId"));

                    b.Property<decimal>("Amount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<int>("EmployeeSalaryStructureId")
                        .HasColumnType("integer");

                    b.Property<int>("SalaryComponentId")
                        .HasColumnType("integer");

                    b.HasKey("EmployeeSalaryStructureLineId");

                    b.HasIndex("EmployeeSalaryStructureId");

                    b.HasIndex("SalaryComponentId");

                    b.ToTable("hr_employee_salary_structure_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b =>
                {
                    b.Property<int>("EmploymentTypeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EmploymentTypeId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("EmploymentTypeId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_employment_types", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b =>
                {
                    b.Property<int>("GrnId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("GrnId"));

                    b.Property<decimal>("BalanceAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("GlJournalNo")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime?>("GlPostedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<decimal>("PaidAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("PoId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("PostedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("VendorId")
                        .HasColumnType("integer");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("GrnId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("PoId");

                    b.HasIndex("Status");

                    b.HasIndex("VendorId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("grns", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b =>
                {
                    b.Property<int>("GrnLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("GrnLineId"));

                    b.Property<int?>("BatchId")
                        .HasColumnType("integer");

                    b.Property<int?>("BinId")
                        .HasColumnType("integer");

                    b.Property<decimal>("DiscountPct")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.Property<int>("GrnId")
                        .HasColumnType("integer");

                    b.Property<string>("HoldStatus")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("LineTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("NetUnitCost")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.Property<int?>("PoLineId")
                        .HasColumnType("integer");

                    b.Property<decimal?>("PoUnitPrice")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("ReceivedValue")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("UnitCost")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.Property<decimal>("VatAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("VatPct")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.HasKey("GrnLineId");

                    b.HasIndex("BatchId");

                    b.HasIndex("BinId");

                    b.HasIndex("GrnId");

                    b.HasIndex("ItemId");

                    b.HasIndex("PoLineId");

                    b.ToTable("grn_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b =>
                {
                    b.Property<int>("GrnLineWarrantyNumberId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("GrnLineWarrantyNumberId"));

                    b.Property<int>("GrnLineId")
                        .HasColumnType("integer");

                    b.Property<string>("WarrantyNo")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<int>("WarrantyPeriodMonths")
                        .HasColumnType("integer");

                    b.HasKey("GrnLineWarrantyNumberId");

                    b.HasIndex("GrnLineId", "WarrantyNo")
                        .IsUnique();

                    b.ToTable("grn_line_warranty_numbers", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b =>
                {
                    b.Property<int>("GrnPaymentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("GrnPaymentId"));

                    b.Property<decimal>("Amount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("BankAccountName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<long>("GlBankAccountId")
                        .HasColumnType("bigint");

                    b.Property<string>("GlJournalNo")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int>("GrnId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("PaymentDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Reference")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.HasKey("GrnPaymentId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("GrnId");

                    b.ToTable("grn_payments", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b =>
                {
                    b.Property<int>("HrDocumentTypeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("HrDocumentTypeId"));

                    b.Property<string>("Category")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<bool>("ExpiryTracked")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<bool>("RequiredAtOnboarding")
                        .HasColumnType("boolean");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("HrDocumentTypeId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_document_types", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Item", b =>
                {
                    b.Property<int>("ItemId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ItemId"));

                    b.Property<int>("BaseUomId")
                        .HasColumnType("integer");

                    b.Property<int?>("BrandId")
                        .HasColumnType("integer");

                    b.Property<int>("CategoryId")
                        .HasColumnType("integer");

                    b.Property<decimal?>("ContentBaseQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("ContentBaseUnit")
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<decimal?>("ContentQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("ContentUnit")
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("DefaultVendorId")
                        .HasColumnType("integer");

                    b.Property<string>("Description")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<decimal?>("SalePrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("Sku")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("StockNature")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int?>("SubCategoryId")
                        .HasColumnType("integer");

                    b.Property<string>("TaxClass")
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("TrackingMode")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Warranty")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("NonWarranty");

                    b.Property<int?>("WarrantyPeriodMonths")
                        .HasColumnType("integer");

                    b.HasKey("ItemId");

                    b.HasIndex("BaseUomId");

                    b.HasIndex("BrandId");

                    b.HasIndex("CategoryId");

                    b.HasIndex("DefaultVendorId");

                    b.HasIndex("Sku")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.HasIndex("SubCategoryId");

                    b.ToTable("items", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b =>
                {
                    b.Property<int>("ReorderId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReorderId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("ReorderPoint")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("ReorderQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("ReorderId");

                    b.HasIndex("WarehouseId");

                    b.HasIndex("ItemId", "WarehouseId")
                        .IsUnique();

                    b.ToTable("item_reorders", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b =>
                {
                    b.Property<int>("ItemTypeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ItemTypeId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<bool>("IsMeasurable")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(false);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("ItemTypeId");

                    b.HasIndex("Name")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("item_types", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b =>
                {
                    b.Property<int>("JournalId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("JournalId"));

                    b.Property<decimal>("Amount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("CreditAccount")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("DebitAccount")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("SourceDocId")
                        .HasColumnType("integer");

                    b.Property<string>("SourceDocType")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)");

                    b.HasKey("JournalId");

                    b.HasIndex("SourceDocType", "SourceDocId");

                    b.ToTable("journal_entry_stubs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b =>
                {
                    b.Property<int>("LeaveBalanceId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("LeaveBalanceId"));

                    b.Property<decimal>("AdjustmentDays")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<decimal>("CarriedForwardDays")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<decimal>("EntitledDays")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<int>("LeaveTypeId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<decimal>("TakenDays")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("Year")
                        .HasColumnType("integer");

                    b.HasKey("LeaveBalanceId");

                    b.HasIndex("LeaveTypeId");

                    b.HasIndex("EmployeeId", "LeaveTypeId", "Year")
                        .IsUnique();

                    b.ToTable("hr_leave_balances", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b =>
                {
                    b.Property<int>("LeaveRequestId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("LeaveRequestId"));

                    b.Property<DateTime?>("ApprovedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("ApprovedBy")
                        .HasColumnType("integer");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<decimal>("DaysCount")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("LeaveTypeId")
                        .HasColumnType("integer");

                    b.Property<string>("Reason")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)");

                    b.Property<string>("RejectionReason")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("LeaveRequestId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("EmployeeId");

                    b.HasIndex("LeaveTypeId");

                    b.HasIndex("Status");

                    b.HasIndex("StartDate", "EndDate");

                    b.ToTable("hr_leave_requests", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b =>
                {
                    b.Property<int>("LeaveTypeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("LeaveTypeId"));

                    b.Property<decimal>("AccrualPerYear")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<bool>("CarryForwardAllowed")
                        .HasColumnType("boolean");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<bool>("CountsAsNoPay")
                        .HasColumnType("boolean");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<bool>("IsPaid")
                        .HasColumnType("boolean");

                    b.Property<int?>("MaxCarryForwardDays")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<bool>("RequiresApproval")
                        .HasColumnType("boolean");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("LeaveTypeId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_leave_types", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b =>
                {
                    b.Property<int>("LoanInstallmentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("LoanInstallmentId"));

                    b.Property<int>("DueMonth")
                        .HasColumnType("integer");

                    b.Property<int>("DueYear")
                        .HasColumnType("integer");

                    b.Property<int>("EmployeeLoanId")
                        .HasColumnType("integer");

                    b.Property<int>("InstallmentNumber")
                        .HasColumnType("integer");

                    b.Property<decimal?>("PaidAmount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<int?>("PayrollRunId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<decimal>("ScheduledAmount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("LoanInstallmentId");

                    b.HasIndex("EmployeeLoanId");

                    b.HasIndex("PayrollRunId");

                    b.HasIndex("DueYear", "DueMonth");

                    b.ToTable("hr_loan_installments", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b =>
                {
                    b.Property<int>("NavItemId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("NavItemId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Href")
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("Icon")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Label")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<int>("SortOrder")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.HasKey("NavItemId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.ToTable("nav_items", (string)null);

                    b.HasData(
                        new
                        {
                            NavItemId = 1,
                            Code = "dashboard",
                            Href = "/dashboard",
                            Label = "Dashboard",
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 2,
                            Code = "products",
                            Href = "/dashboard/products",
                            Label = "Products",
                            SortOrder = 2,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 3,
                            Code = "vendors",
                            Href = "/dashboard/vendors",
                            Label = "Vendors",
                            SortOrder = 3,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 4,
                            Code = "procurement",
                            Href = "/dashboard/procurement",
                            Label = "Procurement",
                            SortOrder = 4,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 5,
                            Code = "receiving",
                            Href = "/dashboard/receiving/grn",
                            Label = "Receiving",
                            SortOrder = 5,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 6,
                            Code = "stock",
                            Href = "/dashboard/stock",
                            Label = "Stock",
                            SortOrder = 6,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 7,
                            Code = "warehouses",
                            Href = "/dashboard/warehouse",
                            Label = "Warehouses",
                            SortOrder = 7,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 8,
                            Code = "orders",
                            Href = "/dashboard/orders",
                            Label = "Orders",
                            SortOrder = 8,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 9,
                            Code = "settings",
                            Href = "/dashboard/settings",
                            Label = "Settings",
                            SortOrder = 9,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 10,
                            Code = "help",
                            Href = "/dashboard/help",
                            Label = "Help",
                            SortOrder = 10,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 11,
                            Code = "ledgers",
                            Href = "/dashboard/ledgers",
                            Label = "Ledgers",
                            SortOrder = 11,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 12,
                            Code = "accounts",
                            Href = "/dashboard/accounts",
                            Label = "Accounts",
                            SortOrder = 12,
                            Status = "Active"
                        },
                        new
                        {
                            NavItemId = 13,
                            Code = "sales",
                            Href = "/dashboard/sales",
                            Label = "Sales",
                            SortOrder = 13,
                            Status = "Active"
                        });
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b =>
                {
                    b.Property<int>("SequenceId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SequenceId"));

                    b.Property<string>("DocType")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)")
                        .HasColumnName("doc_type");

                    b.Property<int>("LastNumber")
                        .HasColumnType("integer")
                        .HasColumnName("last_number");

                    b.Property<int>("Year")
                        .HasColumnType("integer")
                        .HasColumnName("year");

                    b.HasKey("SequenceId");

                    b.HasIndex("DocType", "Year")
                        .IsUnique();

                    b.ToTable("number_sequences", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b =>
                {
                    b.Property<int>("PayrollLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PayrollLineId"));

                    b.Property<int>("AbsentDays")
                        .HasColumnType("integer");

                    b.Property<decimal>("BasicSalary")
                        .HasColumnType("numeric(18,2)");

                    b.Property<int>("EmployeeId")
                        .HasColumnType("integer");

                    b.Property<decimal>("EpfEmployeeAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("EpfEmployerAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("EtfEmployerAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("GrossSalary")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("LateDeductionAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<int>("LateMinutesTotal")
                        .HasColumnType("integer");

                    b.Property<int>("LeaveDays")
                        .HasColumnType("integer");

                    b.Property<decimal>("LoanDeductionAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("NetSalary")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("NoPayAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<int>("OtMinutesTotal")
                        .HasColumnType("integer");

                    b.Property<decimal>("OtherDeductionsAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("OvertimeAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<int>("PayrollRunId")
                        .HasColumnType("integer");

                    b.Property<int>("PresentDays")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<decimal>("TaxAmount")
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("TotalAllowances")
                        .HasColumnType("numeric(18,2)");

                    b.Property<int>("WorkingDays")
                        .HasColumnType("integer");

                    b.HasKey("PayrollLineId");

                    b.HasIndex("EmployeeId");

                    b.HasIndex("PayrollRunId", "EmployeeId")
                        .IsUnique();

                    b.ToTable("hr_payroll_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b =>
                {
                    b.Property<int>("PayrollLineComponentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PayrollLineComponentId"));

                    b.Property<decimal>("Amount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<string>("ComponentCategory")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Label")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<int>("PayrollLineId")
                        .HasColumnType("integer");

                    b.Property<int?>("SalaryComponentId")
                        .HasColumnType("integer");

                    b.Property<int>("SortOrder")
                        .HasColumnType("integer");

                    b.HasKey("PayrollLineComponentId");

                    b.HasIndex("PayrollLineId");

                    b.HasIndex("SalaryComponentId");

                    b.ToTable("hr_payroll_line_components", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b =>
                {
                    b.Property<int>("PayrollRunId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PayrollRunId"));

                    b.Property<DateTime?>("ApprovedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("ApprovedBy")
                        .HasColumnType("integer");

                    b.Property<int?>("BranchId")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime>("GeneratedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("GeneratedBy")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("LockedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("LockedBy")
                        .HasColumnType("integer");

                    b.Property<int>("PeriodMonth")
                        .HasColumnType("integer");

                    b.Property<int>("PeriodYear")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("UnlockReason")
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)");

                    b.Property<DateTime?>("UnlockedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("UnlockedBy")
                        .HasColumnType("integer");

                    b.HasKey("PayrollRunId");

                    b.HasIndex("BranchId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.HasIndex("PeriodYear", "PeriodMonth", "BranchId");

                    b.ToTable("hr_payroll_runs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b =>
                {
                    b.Property<int>("PayrollStatutorySettingId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PayrollStatutorySettingId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<DateTime>("EffectiveFrom")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime?>("EffectiveTo")
                        .HasColumnType("timestamp with time zone");

                    b.Property<decimal>("EpfEmployeeRate")
                        .HasPrecision(6, 4)
                        .HasColumnType("numeric(6,4)");

                    b.Property<decimal>("EpfEmployerRate")
                        .HasPrecision(6, 4)
                        .HasColumnType("numeric(6,4)");

                    b.Property<decimal>("EtfEmployerRate")
                        .HasPrecision(6, 4)
                        .HasColumnType("numeric(6,4)");

                    b.Property<decimal>("OtMultiplierDefault")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.HasKey("PayrollStatutorySettingId");

                    b.HasIndex("EffectiveFrom");

                    b.ToTable("hr_payroll_statutory_settings", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b =>
                {
                    b.Property<int>("PayslipId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PayslipId"));

                    b.Property<DateTime>("GeneratedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("PayrollLineId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("ReleasedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("ReleasedBy")
                        .HasColumnType("integer");

                    b.HasKey("PayslipId");

                    b.HasIndex("PayrollLineId")
                        .IsUnique();

                    b.ToTable("hr_payslips", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b =>
                {
                    b.Property<int>("PermissionId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PermissionId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(80)
                        .HasColumnType("character varying(80)");

                    b.Property<int?>("NavItemId")
                        .HasColumnType("integer");

                    b.Property<int?>("SubNavItemId")
                        .HasColumnType("integer");

                    b.HasKey("PermissionId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("NavItemId");

                    b.HasIndex("SubNavItemId");

                    b.ToTable("permissions", (string)null);

                    b.HasData(
                        new
                        {
                            PermissionId = 1,
                            Code = "NAV:dashboard",
                            NavItemId = 1
                        },
                        new
                        {
                            PermissionId = 2,
                            Code = "NAV:products",
                            NavItemId = 2
                        },
                        new
                        {
                            PermissionId = 3,
                            Code = "NAV:vendors",
                            NavItemId = 3
                        },
                        new
                        {
                            PermissionId = 4,
                            Code = "NAV:procurement",
                            NavItemId = 4
                        },
                        new
                        {
                            PermissionId = 5,
                            Code = "NAV:receiving",
                            NavItemId = 5
                        },
                        new
                        {
                            PermissionId = 6,
                            Code = "NAV:stock",
                            NavItemId = 6
                        },
                        new
                        {
                            PermissionId = 7,
                            Code = "NAV:warehouses",
                            NavItemId = 7
                        },
                        new
                        {
                            PermissionId = 8,
                            Code = "NAV:orders",
                            NavItemId = 8
                        },
                        new
                        {
                            PermissionId = 9,
                            Code = "NAV:settings",
                            NavItemId = 9
                        },
                        new
                        {
                            PermissionId = 10,
                            Code = "NAV:help",
                            NavItemId = 10
                        },
                        new
                        {
                            PermissionId = 11,
                            Code = "NAV:products.item",
                            SubNavItemId = 1
                        },
                        new
                        {
                            PermissionId = 12,
                            Code = "NAV:products.category",
                            SubNavItemId = 2
                        },
                        new
                        {
                            PermissionId = 13,
                            Code = "NAV:products.brand",
                            SubNavItemId = 3
                        },
                        new
                        {
                            PermissionId = 14,
                            Code = "NAV:products.item-type",
                            SubNavItemId = 4
                        },
                        new
                        {
                            PermissionId = 15,
                            Code = "NAV:products.uom",
                            SubNavItemId = 5
                        },
                        new
                        {
                            PermissionId = 16,
                            Code = "NAV:products.configuration",
                            SubNavItemId = 6
                        },
                        new
                        {
                            PermissionId = 17,
                            Code = "NAV:settings.roles",
                            SubNavItemId = 7
                        },
                        new
                        {
                            PermissionId = 18,
                            Code = "NAV:settings.users",
                            SubNavItemId = 8
                        },
                        new
                        {
                            PermissionId = 28,
                            Code = "NAV:procurement.requisitions",
                            SubNavItemId = 17
                        },
                        new
                        {
                            PermissionId = 29,
                            Code = "NAV:procurement.rfqs",
                            SubNavItemId = 18
                        },
                        new
                        {
                            PermissionId = 30,
                            Code = "NAV:procurement.purchase-orders",
                            SubNavItemId = 19
                        },
                        new
                        {
                            PermissionId = 31,
                            Code = "NAV:procurement.purchase-returns",
                            SubNavItemId = 20
                        },
                        new
                        {
                            PermissionId = 19,
                            Code = "NAV:ledgers",
                            NavItemId = 11
                        },
                        new
                        {
                            PermissionId = 20,
                            Code = "NAV:ledgers.trial-balance",
                            SubNavItemId = 9
                        },
                        new
                        {
                            PermissionId = 21,
                            Code = "NAV:ledgers.balance-sheet",
                            SubNavItemId = 10
                        },
                        new
                        {
                            PermissionId = 22,
                            Code = "NAV:ledgers.general-ledger",
                            SubNavItemId = 11
                        },
                        new
                        {
                            PermissionId = 23,
                            Code = "NAV:ledgers.profit-and-loss",
                            SubNavItemId = 12
                        },
                        new
                        {
                            PermissionId = 24,
                            Code = "NAV:ledgers.cash-flow",
                            SubNavItemId = 13
                        },
                        new
                        {
                            PermissionId = 25,
                            Code = "NAV:ledgers.budget-vs-actual",
                            SubNavItemId = 14
                        },
                        new
                        {
                            PermissionId = 27,
                            Code = "NAV:ledgers.tax-report",
                            SubNavItemId = 16
                        },
                        new
                        {
                            PermissionId = 26,
                            Code = "NAV:accounts.bank-accounts",
                            SubNavItemId = 15
                        },
                        new
                        {
                            PermissionId = 32,
                            Code = "NAV:accounts",
                            NavItemId = 12
                        },
                        new
                        {
                            PermissionId = 33,
                            Code = "NAV:accounts.cheque-books",
                            SubNavItemId = 21
                        },
                        new
                        {
                            PermissionId = 34,
                            Code = "NAV:accounts.received-cheques",
                            SubNavItemId = 22
                        });
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b =>
                {
                    b.Property<int>("PoLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PoLineId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<int>("PoId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("QtyReceived")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("Tax")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.Property<decimal>("UnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("PoLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("PoId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("po_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b =>
                {
                    b.Property<int>("ConfigId")
                        .HasColumnType("integer");

                    b.Property<bool>("BrandsEnabled")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(true);

                    b.Property<bool>("ItemTypesEnabled")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(true);

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<bool>("SubcategoriesEnabled")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(true);

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("UpdatedBy")
                        .HasColumnType("integer");

                    b.HasKey("ConfigId");

                    b.HasIndex("UpdatedBy");

                    b.ToTable("product_config", null, t =>
                        {
                            t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1");
                        });
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b =>
                {
                    b.Property<int>("RunId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RunId"));

                    b.Property<int?>("CancelReasonCodeId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("CompletedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int?>("OutputBinId")
                        .HasColumnType("integer");

                    b.Property<int>("ReworkCount")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<decimal>("ScaleFactor")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<decimal>("TargetQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("TemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("RunId");

                    b.HasIndex("CancelReasonCodeId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("OutputBinId");

                    b.HasIndex("Status");

                    b.HasIndex("WarehouseId");

                    b.HasIndex("TemplateId", "Status");

                    b.ToTable("production_runs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b =>
                {
                    b.Property<int>("TemplateId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TemplateId"));

                    b.Property<string>("Annotations")
                        .HasColumnType("jsonb");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("Description")
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(150)
                        .HasColumnType("character varying(150)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("TemplateId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("CreatedBy");

                    b.HasIndex("Status");

                    b.ToTable("production_templates", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b =>
                {
                    b.Property<int>("PoId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PoId"));

                    b.Property<bool>("ApprovalRequired")
                        .HasColumnType("boolean");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int?>("RequisitionId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("VendorId")
                        .HasColumnType("integer");

                    b.HasKey("PoId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("RequisitionId");

                    b.HasIndex("Status");

                    b.HasIndex("VendorId");

                    b.ToTable("purchase_orders", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b =>
                {
                    b.Property<int>("ReturnId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReturnId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("GlJournalNo")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime?>("GlPostedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("ReasonCodeId")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("VendorId")
                        .HasColumnType("integer");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("ReturnId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("ReasonCodeId");

                    b.HasIndex("VendorId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("purchase_returns", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b =>
                {
                    b.Property<int>("ReturnLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReturnLineId"));

                    b.Property<int?>("GrnLineId")
                        .HasColumnType("integer");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("ReturnId")
                        .HasColumnType("integer");

                    b.HasKey("ReturnLineId");

                    b.HasIndex("GrnLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("ReturnId");

                    b.ToTable("purchase_return_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b =>
                {
                    b.Property<int>("ReasonCodeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReasonCodeId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Context")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.HasKey("ReasonCodeId");

                    b.HasIndex("Context", "Code")
                        .IsUnique();

                    b.ToTable("reason_codes", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b =>
                {
                    b.Property<int>("RequisitionId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RequisitionId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int>("RequestedBy")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("RequisitionId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("RequestedBy");

                    b.HasIndex("Status");

                    b.ToTable("requisitions", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b =>
                {
                    b.Property<int>("ReqLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReqLineId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateOnly?>("RequiredBy")
                        .HasColumnType("date");

                    b.Property<int>("RequisitionId")
                        .HasColumnType("integer");

                    b.HasKey("ReqLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("RequisitionId");

                    b.ToTable("requisition_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b =>
                {
                    b.Property<int>("RfqId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RfqId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<int>("RequisitionId")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("RfqId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("RequisitionId");

                    b.ToTable("rfqs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b =>
                {
                    b.Property<int>("RfqLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RfqLineId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("RfqId")
                        .HasColumnType("integer");

                    b.HasKey("RfqLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("RfqId");

                    b.ToTable("rfq_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Role", b =>
                {
                    b.Property<int>("RoleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RoleId"));

                    b.Property<Guid>("AuthRoleId")
                        .HasColumnType("uuid")
                        .HasColumnName("auth_role_id");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<bool>("IsSystemRole")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("boolean")
                        .HasDefaultValue(false);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("RoleId");

                    b.HasIndex("AuthRoleId")
                        .IsUnique();

                    b.HasIndex("Code")
                        .IsUnique();

                    b.ToTable("roles", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b =>
                {
                    b.Property<int>("RoleId")
                        .HasColumnType("integer");

                    b.Property<int>("PermissionId")
                        .HasColumnType("integer");

                    b.HasKey("RoleId", "PermissionId");

                    b.HasIndex("PermissionId");

                    b.ToTable("role_permissions", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b =>
                {
                    b.Property<int>("RunEdgeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RunEdgeId"));

                    b.Property<int>("ChildRunStageId")
                        .HasColumnType("integer");

                    b.Property<int>("ParentRunStageId")
                        .HasColumnType("integer");

                    b.Property<int>("RunId")
                        .HasColumnType("integer");

                    b.HasKey("RunEdgeId");

                    b.HasIndex("ChildRunStageId");

                    b.HasIndex("RunId");

                    b.HasIndex("ParentRunStageId", "ChildRunStageId")
                        .IsUnique();

                    b.ToTable("run_edges", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b =>
                {
                    b.Property<int>("RunStageId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RunStageId"));

                    b.Property<DateTime?>("ActualEndAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime?>("ActualStartAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("EstimatedMinutes")
                        .HasColumnType("integer");

                    b.Property<string>("FieldDefs")
                        .IsRequired()
                        .HasColumnType("jsonb");

                    b.Property<string>("FieldValues")
                        .HasColumnType("jsonb");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(150)
                        .HasColumnType("character varying(150)");

                    b.Property<decimal>("PosX")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("PosY")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("RoleLabel")
                        .HasMaxLength(60)
                        .HasColumnType("character varying(60)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("RunId")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int?>("TemplateStageId")
                        .HasColumnType("integer");

                    b.HasKey("RunStageId");

                    b.HasIndex("TemplateStageId");

                    b.HasIndex("RunId", "Status");

                    b.ToTable("run_stages", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b =>
                {
                    b.Property<int>("EventId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EventId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("EventType")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Note")
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)");

                    b.Property<string>("Payload")
                        .HasColumnType("jsonb");

                    b.Property<int>("RunId")
                        .HasColumnType("integer");

                    b.Property<int?>("RunStageId")
                        .HasColumnType("integer");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("EventId");

                    b.HasIndex("RunStageId");

                    b.HasIndex("UserId");

                    b.HasIndex("RunId", "EventId");

                    b.ToTable("run_stage_events", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b =>
                {
                    b.Property<int>("RunInputId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RunInputId"));

                    b.Property<decimal>("ConsumedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("ConsumedValue")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("DeliveredQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("FromRunOutputId")
                        .HasColumnType("integer");

                    b.Property<int?>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("PlannedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("QtyUnit")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<decimal>("ReturnedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("ReturnedValue")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("RunStageId")
                        .HasColumnType("integer");

                    b.Property<string>("Source")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("RunInputId");

                    b.HasIndex("FromRunOutputId");

                    b.HasIndex("ItemId");

                    b.HasIndex("RunStageId");

                    b.ToTable("run_stage_inputs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b =>
                {
                    b.Property<int>("RunOutputId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("RunOutputId"));

                    b.Property<int?>("ItemId")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(150)
                        .HasColumnType("character varying(150)");

                    b.Property<decimal>("PlannedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("ProducedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("RunStageId")
                        .HasColumnType("integer");

                    b.Property<int?>("ScrapReasonCodeId")
                        .HasColumnType("integer");

                    b.Property<decimal>("ScrappedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("TransferredQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("UomId")
                        .HasColumnType("integer");

                    b.HasKey("RunOutputId");

                    b.HasIndex("ItemId");

                    b.HasIndex("RunStageId");

                    b.HasIndex("ScrapReasonCodeId");

                    b.HasIndex("UomId");

                    b.ToTable("run_stage_outputs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b =>
                {
                    b.Property<int>("SalaryComponentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SalaryComponentId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("ComponentType")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<bool>("IsEpfEtfApplicable")
                        .HasColumnType("boolean");

                    b.Property<bool>("IsTaxable")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("SalaryComponentId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_salary_components", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b =>
                {
                    b.Property<int>("SalesDayEndId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SalesDayEndId"));

                    b.Property<DateOnly>("BusinessDate")
                        .HasColumnType("date");

                    b.Property<int>("CashierUserId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("ClosedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("ClosedBy")
                        .HasColumnType("integer");

                    b.Property<decimal>("CostOfGoodsSold")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("DiscountTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("GlJournalNo")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime?>("GlPostedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<decimal>("GrandTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("SlipCount")
                        .HasColumnType("integer");

                    b.Property<decimal>("Subtotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("TaxTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.HasKey("SalesDayEndId");

                    b.HasIndex("ClosedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("CashierUserId", "BusinessDate")
                        .IsUnique();

                    b.ToTable("sales_day_ends", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b =>
                {
                    b.Property<int>("SalesInvoiceId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SalesInvoiceId"));

                    b.Property<decimal>("BalanceAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<int?>("CreatorUserId")
                        .HasColumnType("integer");

                    b.Property<int>("CustomerId")
                        .HasColumnType("integer");

                    b.Property<string>("CustomerSnapshotName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("CustomerSnapshotTaxNo")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<decimal>("DiscountTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("GrandTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime>("InvoiceDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("InvoiceNo")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("InvoiceType")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("B2C");

                    b.Property<decimal>("NetPayable")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("PaidAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("RoundOff")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Draft");

                    b.Property<decimal>("Subtotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("TaxTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("SalesInvoiceId");

                    b.HasIndex("CreatorUserId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("InvoiceDate");

                    b.HasIndex("InvoiceNo")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.HasIndex("WarehouseId");

                    b.ToTable("sales_invoices", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b =>
                {
                    b.Property<int>("SalesInvoiceLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SalesInvoiceLineId"));

                    b.Property<decimal>("BaseCost")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<decimal>("DiscountAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("DiscountMode")
                        .HasColumnType("integer");

                    b.Property<decimal>("DiscountPct")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.Property<decimal>("FreeQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<bool>("IsFreeIssue")
                        .HasColumnType("boolean");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("LineTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("NetUnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("ParentLineId")
                        .HasColumnType("integer");

                    b.Property<string>("PriceSource")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("SalesInvoiceId")
                        .HasColumnType("integer");

                    b.Property<decimal>("TaxAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("TaxPct")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.Property<decimal>("UnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("SalesInvoiceLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("SalesInvoiceId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("sales_invoice_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b =>
                {
                    b.Property<int>("ReturnId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReturnId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<int>("CustomerId")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("GlJournalNo")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime?>("GlPostedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("ReasonCodeId")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("ReturnId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("CustomerId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("ReasonCodeId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("sales_returns", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b =>
                {
                    b.Property<int>("ReturnLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReturnLineId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("ReturnId")
                        .HasColumnType("integer");

                    b.Property<int?>("SalesInvoiceLineId")
                        .HasColumnType("integer");

                    b.HasKey("ReturnLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("ReturnId");

                    b.HasIndex("SalesInvoiceLineId");

                    b.ToTable("sales_return_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b =>
                {
                    b.Property<int>("SalesSlipId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SalesSlipId"));

                    b.Property<decimal>("BalanceAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("CashierUserId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CustomerId")
                        .HasColumnType("integer");

                    b.Property<string>("CustomerSnapshotName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<int?>("DayEndId")
                        .HasColumnType("integer");

                    b.Property<decimal>("DiscountTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("GrandTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("PaidAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<DateTime>("SlipDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("SlipNo")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Draft");

                    b.Property<decimal>("Subtotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("TaxTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("SalesSlipId");

                    b.HasIndex("CashierUserId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("DayEndId");

                    b.HasIndex("SlipDate");

                    b.HasIndex("SlipNo")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.HasIndex("WarehouseId");

                    b.ToTable("sales_slips", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b =>
                {
                    b.Property<int>("SalesSlipLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SalesSlipLineId"));

                    b.Property<decimal>("BaseCost")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<decimal>("DiscountAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("DiscountMode")
                        .HasColumnType("integer");

                    b.Property<decimal>("DiscountPct")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.Property<decimal>("FreeQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<bool>("IsFreeIssue")
                        .HasColumnType("boolean");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("LineTotal")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("NetUnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("ParentLineId")
                        .HasColumnType("integer");

                    b.Property<string>("PriceSource")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("SalesSlipId")
                        .HasColumnType("integer");

                    b.Property<decimal>("TaxAmount")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("TaxPct")
                        .HasPrecision(9, 4)
                        .HasColumnType("numeric(9,4)");

                    b.Property<decimal>("UnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("SalesSlipLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("SalesSlipId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("sales_slip_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b =>
                {
                    b.Property<int>("SerialId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SerialId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<string>("SerialNo")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("SerialId");

                    b.HasIndex("ItemId", "SerialNo")
                        .IsUnique();

                    b.ToTable("serials", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b =>
                {
                    b.Property<int>("EdgeId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EdgeId"));

                    b.Property<int>("ChildStageId")
                        .HasColumnType("integer");

                    b.Property<int>("ParentStageId")
                        .HasColumnType("integer");

                    b.Property<int>("TemplateId")
                        .HasColumnType("integer");

                    b.HasKey("EdgeId");

                    b.HasIndex("ChildStageId");

                    b.HasIndex("TemplateId");

                    b.HasIndex("ParentStageId", "ChildStageId")
                        .IsUnique();

                    b.ToTable("stage_edges", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b =>
                {
                    b.Property<int>("InputId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("InputId"));

                    b.Property<int?>("FromOutputId")
                        .HasColumnType("integer");

                    b.Property<int?>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("QtyPerBatch")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("QtyUnit")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Source")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("StageId")
                        .HasColumnType("integer");

                    b.HasKey("InputId");

                    b.HasIndex("FromOutputId");

                    b.HasIndex("ItemId");

                    b.HasIndex("StageId");

                    b.ToTable("stage_inputs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b =>
                {
                    b.Property<int>("OutputId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("OutputId"));

                    b.Property<int?>("ItemId")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(150)
                        .HasColumnType("character varying(150)");

                    b.Property<decimal>("QtyPerBatch")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("StageId")
                        .HasColumnType("integer");

                    b.Property<int?>("UomId")
                        .HasColumnType("integer");

                    b.HasKey("OutputId");

                    b.HasIndex("ItemId");

                    b.HasIndex("StageId");

                    b.HasIndex("UomId");

                    b.ToTable("stage_outputs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b =>
                {
                    b.Property<int>("AdjustmentId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AdjustmentId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<string>("GlJournalNo")
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<DateTime?>("GlPostedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("ReasonCodeId")
                        .HasColumnType("integer");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("AdjustmentId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("ReasonCodeId");

                    b.HasIndex("WarehouseId");

                    b.ToTable("stock_adjustments", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b =>
                {
                    b.Property<int>("AdjLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("AdjLineId"));

                    b.Property<int>("AdjustmentId")
                        .HasColumnType("integer");

                    b.Property<int?>("BatchId")
                        .HasColumnType("integer");

                    b.Property<int?>("BinId")
                        .HasColumnType("integer");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("QtyDelta")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("SerialId")
                        .HasColumnType("integer");

                    b.HasKey("AdjLineId");

                    b.HasIndex("AdjustmentId");

                    b.HasIndex("BatchId");

                    b.HasIndex("BinId");

                    b.HasIndex("ItemId");

                    b.HasIndex("SerialId");

                    b.ToTable("stock_adjustment_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b =>
                {
                    b.Property<int>("CountId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("CountId"));

                    b.Property<string>("CountType")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("CountId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.HasIndex("WarehouseId");

                    b.ToTable("stock_counts", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b =>
                {
                    b.Property<int>("CountLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("CountLineId"));

                    b.Property<int?>("BinId")
                        .HasColumnType("integer");

                    b.Property<int>("CountId")
                        .HasColumnType("integer");

                    b.Property<decimal?>("CountedQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("SystemQty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal?>("Variance")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.HasKey("CountLineId");

                    b.HasIndex("BinId");

                    b.HasIndex("CountId");

                    b.HasIndex("ItemId");

                    b.ToTable("stock_count_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b =>
                {
                    b.Property<int>("LayerId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("LayerId"));

                    b.Property<int?>("BatchId")
                        .HasColumnType("integer");

                    b.Property<int?>("GrnLineId")
                        .HasColumnType("integer");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("QtyReceived")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("QtyRemaining")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<DateTime>("ReceiptDate")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("SerialId")
                        .HasColumnType("integer");

                    b.Property<decimal>("UnitCost")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("LayerId");

                    b.HasIndex("BatchId");

                    b.HasIndex("GrnLineId");

                    b.HasIndex("SerialId");

                    b.HasIndex("WarehouseId");

                    b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId");

                    b.ToTable("stock_layers", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b =>
                {
                    b.Property<int>("LedgerId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("LedgerId"));

                    b.Property<int?>("BatchId")
                        .HasColumnType("integer");

                    b.Property<int?>("BinId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Direction")
                        .IsRequired()
                        .HasMaxLength(5)
                        .HasColumnType("character varying(5)");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("QtyBase")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("RunningBalance")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("SerialId")
                        .HasColumnType("integer");

                    b.Property<int>("SourceDocId")
                        .HasColumnType("integer");

                    b.Property<string>("SourceDocType")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)");

                    b.Property<decimal>("UnitCost")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Value")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int>("WarehouseId")
                        .HasColumnType("integer");

                    b.HasKey("LedgerId");

                    b.HasIndex("BatchId");

                    b.HasIndex("BinId");

                    b.HasIndex("SerialId");

                    b.HasIndex("UserId");

                    b.HasIndex("WarehouseId");

                    b.HasIndex("SourceDocType", "SourceDocId");

                    b.HasIndex("ItemId", "WarehouseId", "CreatedAt");

                    b.HasIndex("ItemId", "WarehouseId", "LedgerId");

                    b.ToTable("stock_ledger", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b =>
                {
                    b.Property<int>("TransferId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TransferId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("CreatedBy")
                        .HasColumnType("integer");

                    b.Property<int>("DestWarehouseId")
                        .HasColumnType("integer");

                    b.Property<string>("DocNo")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("SrcWarehouseId")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.HasKey("TransferId");

                    b.HasIndex("CreatedBy");

                    b.HasIndex("DestWarehouseId");

                    b.HasIndex("DocNo")
                        .IsUnique();

                    b.HasIndex("SrcWarehouseId");

                    b.HasIndex("Status");

                    b.ToTable("stock_transfers", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b =>
                {
                    b.Property<int>("TransferLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TransferLineId"));

                    b.Property<int?>("BatchId")
                        .HasColumnType("integer");

                    b.Property<int?>("DestBinId")
                        .HasColumnType("integer");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<decimal>("Qty")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("QtyReceived")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<int?>("SerialId")
                        .HasColumnType("integer");

                    b.Property<int?>("SrcBinId")
                        .HasColumnType("integer");

                    b.Property<int>("TransferId")
                        .HasColumnType("integer");

                    b.Property<decimal?>("UnitCost")
                        .HasPrecision(18, 6)
                        .HasColumnType("numeric(18,6)");

                    b.HasKey("TransferLineId");

                    b.HasIndex("BatchId");

                    b.HasIndex("DestBinId");

                    b.HasIndex("ItemId");

                    b.HasIndex("SerialId");

                    b.HasIndex("SrcBinId");

                    b.HasIndex("TransferId");

                    b.ToTable("stock_transfer_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b =>
                {
                    b.Property<int>("SubCategoryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SubCategoryId"));

                    b.Property<int>("CategoryId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("SubCategoryId");

                    b.HasIndex("Status");

                    b.HasIndex("CategoryId", "Name")
                        .IsUnique();

                    b.ToTable("subcategories", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b =>
                {
                    b.Property<int>("SubNavItemId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SubNavItemId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Href")
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("Icon")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Label")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.Property<int>("NavItemId")
                        .HasColumnType("integer");

                    b.Property<int>("SortOrder")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.HasKey("SubNavItemId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("NavItemId");

                    b.ToTable("sub_nav_items", (string)null);

                    b.HasData(
                        new
                        {
                            SubNavItemId = 1,
                            Code = "products.item",
                            Href = "/dashboard/products",
                            Label = "Item",
                            NavItemId = 2,
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 2,
                            Code = "products.category",
                            Href = "/dashboard/products/categories",
                            Label = "Category",
                            NavItemId = 2,
                            SortOrder = 2,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 3,
                            Code = "products.brand",
                            Href = "/dashboard/products/brands",
                            Label = "Brand",
                            NavItemId = 2,
                            SortOrder = 3,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 4,
                            Code = "products.item-type",
                            Href = "/dashboard/products/item-types",
                            Label = "Item Type",
                            NavItemId = 2,
                            SortOrder = 4,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 5,
                            Code = "products.uom",
                            Href = "/dashboard/products/uoms",
                            Label = "UOM",
                            NavItemId = 2,
                            SortOrder = 5,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 6,
                            Code = "products.configuration",
                            Href = "/dashboard/products/settings",
                            Label = "Configuration",
                            NavItemId = 2,
                            SortOrder = 6,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 7,
                            Code = "settings.roles",
                            Href = "/dashboard/settings/roles",
                            Label = "Roles",
                            NavItemId = 9,
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 8,
                            Code = "settings.users",
                            Href = "/dashboard/settings/users",
                            Label = "Users",
                            NavItemId = 9,
                            SortOrder = 2,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 23,
                            Code = "sales.bundle-sales",
                            Href = "/dashboard/sales/bundles",
                            Label = "Bundle Sales",
                            NavItemId = 13,
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 17,
                            Code = "procurement.requisitions",
                            Href = "/dashboard/procurement/requisitions",
                            Label = "Requisitions",
                            NavItemId = 4,
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 18,
                            Code = "procurement.rfqs",
                            Href = "/dashboard/procurement/rfqs",
                            Label = "RFQs",
                            NavItemId = 4,
                            SortOrder = 2,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 19,
                            Code = "procurement.purchase-orders",
                            Href = "/dashboard/procurement/purchase-orders",
                            Label = "Purchase Orders",
                            NavItemId = 4,
                            SortOrder = 3,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 20,
                            Code = "procurement.purchase-returns",
                            Href = "/dashboard/procurement/purchase-returns",
                            Label = "Purchase Returns",
                            NavItemId = 4,
                            SortOrder = 4,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 9,
                            Code = "ledgers.trial-balance",
                            Href = "/dashboard/ledgers/trial-balance",
                            Label = "Trial Balance",
                            NavItemId = 11,
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 10,
                            Code = "ledgers.balance-sheet",
                            Href = "/dashboard/ledgers/balance-sheet",
                            Label = "Balance Sheet",
                            NavItemId = 11,
                            SortOrder = 2,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 11,
                            Code = "ledgers.general-ledger",
                            Href = "/dashboard/ledgers/general-ledger",
                            Label = "General Ledger",
                            NavItemId = 11,
                            SortOrder = 3,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 12,
                            Code = "ledgers.profit-and-loss",
                            Href = "/dashboard/ledgers/profit-and-loss",
                            Label = "Profit & Loss",
                            NavItemId = 11,
                            SortOrder = 4,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 13,
                            Code = "ledgers.cash-flow",
                            Href = "/dashboard/ledgers/cash-flow",
                            Label = "Cash Flow",
                            NavItemId = 11,
                            SortOrder = 5,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 14,
                            Code = "ledgers.budget-vs-actual",
                            Href = "/dashboard/ledgers/budget-vs-actual",
                            Label = "Budget vs Actual",
                            NavItemId = 11,
                            SortOrder = 6,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 16,
                            Code = "ledgers.tax-report",
                            Href = "/dashboard/ledgers/tax-report",
                            Label = "Tax Report",
                            NavItemId = 11,
                            SortOrder = 7,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 15,
                            Code = "accounts.bank-accounts",
                            Href = "/dashboard/accounts/bank-accounts",
                            Label = "Cash / Bank Accounts",
                            NavItemId = 12,
                            SortOrder = 1,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 21,
                            Code = "accounts.cheque-books",
                            Href = "/dashboard/accounts/cheque-books",
                            Label = "Cheque Books",
                            NavItemId = 12,
                            SortOrder = 2,
                            Status = "Active"
                        },
                        new
                        {
                            SubNavItemId = 22,
                            Code = "accounts.received-cheques",
                            Href = "/dashboard/accounts/received-cheques",
                            Label = "Received Cheques",
                            NavItemId = 12,
                            SortOrder = 3,
                            Status = "Active"
                        });
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b =>
                {
                    b.Property<int>("TaxSlabId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TaxSlabId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime>("EffectiveFrom")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime?>("EffectiveTo")
                        .HasColumnType("timestamp with time zone");

                    b.Property<decimal>("LowerBound")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.Property<decimal>("Rate")
                        .HasPrecision(6, 4)
                        .HasColumnType("numeric(6,4)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<decimal?>("UpperBound")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)");

                    b.HasKey("TaxSlabId");

                    b.HasIndex("EffectiveFrom");

                    b.ToTable("hr_tax_slabs", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b =>
                {
                    b.Property<int>("StageId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("StageId"));

                    b.Property<int>("EstimatedMinutes")
                        .HasColumnType("integer");

                    b.Property<string>("FieldDefs")
                        .IsRequired()
                        .HasColumnType("jsonb");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(150)
                        .HasColumnType("character varying(150)");

                    b.Property<decimal>("PosX")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<decimal>("PosY")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.Property<string>("RoleLabel")
                        .HasMaxLength(60)
                        .HasColumnType("character varying(60)");

                    b.Property<int>("TemplateId")
                        .HasColumnType("integer");

                    b.HasKey("StageId");

                    b.HasIndex("TemplateId");

                    b.ToTable("template_stages", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b =>
                {
                    b.Property<int>("UomId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UomId"));

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.HasKey("UomId");

                    b.HasIndex("Name")
                        .IsUnique();

                    b.ToTable("uoms", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.User", b =>
                {
                    b.Property<int>("UserId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UserId"));

                    b.Property<Guid?>("AuthUserId")
                        .HasColumnType("uuid")
                        .HasColumnName("auth_user_id");

                    b.Property<string>("DisplayName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<string>("Email")
                        .HasMaxLength(320)
                        .HasColumnType("character varying(320)");

                    b.Property<int?>("RoleId")
                        .HasColumnType("integer");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<string>("Username")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)");

                    b.HasKey("UserId");

                    b.HasIndex("AuthUserId")
                        .IsUnique();

                    b.HasIndex("Email")
                        .IsUnique();

                    b.HasIndex("RoleId");

                    b.HasIndex("Username")
                        .IsUnique();

                    b.ToTable("users", (string)null);

                    b.HasData(
                        new
                        {
                            UserId = 1,
                            DisplayName = "System",
                            Status = "Active",
                            Username = "system"
                        });
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b =>
                {
                    b.Property<int>("VendorId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("VendorId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Currency")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(3)
                        .HasColumnType("character varying(3)")
                        .HasDefaultValue("LKR");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<string>("TaxReg")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Terms")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("VendorId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("vendors", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b =>
                {
                    b.Property<int>("QuotationId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("QuotationId"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("RfqId")
                        .HasColumnType("integer");

                    b.Property<int>("VendorId")
                        .HasColumnType("integer");

                    b.HasKey("QuotationId");

                    b.HasIndex("VendorId");

                    b.HasIndex("RfqId", "VendorId")
                        .IsUnique();

                    b.ToTable("vendor_quotations", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b =>
                {
                    b.Property<int>("QuotationLineId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("QuotationLineId"));

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

                    b.Property<int>("LeadDays")
                        .HasColumnType("integer");

                    b.Property<int>("QuotationId")
                        .HasColumnType("integer");

                    b.Property<decimal>("UnitPrice")
                        .HasPrecision(18, 4)
                        .HasColumnType("numeric(18,4)");

                    b.HasKey("QuotationLineId");

                    b.HasIndex("ItemId");

                    b.HasIndex("QuotationId");

                    b.ToTable("vendor_quotation_lines", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b =>
                {
                    b.Property<int>("WarehouseId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("WarehouseId"));

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.HasKey("WarehouseId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.ToTable("warehouses", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b =>
                {
                    b.Property<int>("WorkShiftId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("WorkShiftId"));

                    b.Property<int>("BreakMinutes")
                        .HasColumnType("integer");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<TimeSpan>("EndTime")
                        .HasColumnType("interval");

                    b.Property<int>("GraceMinutes")
                        .HasColumnType("integer");

                    b.Property<bool>("IsOvernight")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)");

                    b.Property<decimal>("OtMultiplier")
                        .HasPrecision(6, 2)
                        .HasColumnType("numeric(6,2)");

                    b.Property<uint>("RowVersion")
                        .IsConcurrencyToken()
                        .ValueGeneratedOnAddOrUpdate()
                        .HasColumnType("xid")
                        .HasColumnName("xmin");

                    b.Property<int>("StandardWorkingMinutes")
                        .HasColumnType("integer");

                    b.Property<TimeSpan>("StartTime")
                        .HasColumnType("interval");

                    b.Property<string>("Status")
                        .IsRequired()
                        .ValueGeneratedOnAdd()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasDefaultValue("Active");

                    b.Property<DateTime?>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("WorkingDaysMask")
                        .HasColumnType("integer");

                    b.HasKey("WorkShiftId");

                    b.HasIndex("Code")
                        .IsUnique();

                    b.HasIndex("Status");

                    b.ToTable("hr_work_shifts", (string)null);
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch")
                        .WithMany()
                        .HasForeignKey("AttendanceUploadBatchId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift")
                        .WithMany()
                        .HasForeignKey("WorkShiftId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AttendanceUploadBatch");

                    b.Navigation("Employee");

                    b.Navigation("WorkShift");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany("Bins")
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate")
                        .WithMany()
                        .HasForeignKey("BundleSaleTemplateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.User", "CashierUser")
                        .WithMany()
                        .HasForeignKey("CashierUserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("BundleSaleTemplate");

                    b.Navigation("CashierUser");

                    b.Navigation("Customer");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale")
                        .WithMany("Lines")
                        .HasForeignKey("BundleSaleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("BundleSale");

                    b.Navigation("Item");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate")
                        .WithMany("Lines")
                        .HasForeignKey("BundleSaleTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("BundleSaleTemplate");

                    b.Navigation("Item");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse")
                        .WithMany()
                        .HasForeignKey("DefaultWarehouseId")
                        .OnDelete(DeleteBehavior.SetNull);

                    b.Navigation("DefaultWarehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Department", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Branch", "Branch")
                        .WithMany()
                        .HasForeignKey("BranchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee")
                        .WithMany()
                        .HasForeignKey("HeadEmployeeId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment")
                        .WithMany()
                        .HasForeignKey("ParentDepartmentId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Branch");

                    b.Navigation("HeadEmployee");

                    b.Navigation("ParentDepartment");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Branch", "Branch")
                        .WithMany()
                        .HasForeignKey("BranchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Department", "Department")
                        .WithMany()
                        .HasForeignKey("DepartmentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Designation", "Designation")
                        .WithMany()
                        .HasForeignKey("DesignationId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType")
                        .WithMany()
                        .HasForeignKey("EmploymentTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager")
                        .WithMany()
                        .HasForeignKey("ReportingManagerId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.User", "User")
                        .WithOne()
                        .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift")
                        .WithMany()
                        .HasForeignKey("WorkShiftId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Branch");

                    b.Navigation("Department");

                    b.Navigation("Designation");

                    b.Navigation("EmploymentType");

                    b.Navigation("ReportingManager");

                    b.Navigation("User");

                    b.Navigation("WorkShift");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Employee");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType")
                        .WithMany()
                        .HasForeignKey("HrDocumentTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Employee");

                    b.Navigation("HrDocumentType");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Employee");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Employee");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure")
                        .WithMany("Lines")
                        .HasForeignKey("EmployeeSalaryStructureId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent")
                        .WithMany()
                        .HasForeignKey("SalaryComponentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("EmployeeSalaryStructure");

                    b.Navigation("SalaryComponent");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder")
                        .WithMany()
                        .HasForeignKey("PoId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor")
                        .WithMany()
                        .HasForeignKey("VendorId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("PurchaseOrder");

                    b.Navigation("Vendor");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Batch", "Batch")
                        .WithMany()
                        .HasForeignKey("BatchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Bin", "Bin")
                        .WithMany()
                        .HasForeignKey("BinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Grn", "Grn")
                        .WithMany("Lines")
                        .HasForeignKey("GrnId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine")
                        .WithMany()
                        .HasForeignKey("PoLineId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Batch");

                    b.Navigation("Bin");

                    b.Navigation("Grn");

                    b.Navigation("Item");

                    b.Navigation("PoLine");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine")
                        .WithMany("WarrantyNumbers")
                        .HasForeignKey("GrnLineId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("GrnLine");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Grn", "Grn")
                        .WithMany("Payments")
                        .HasForeignKey("GrnId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("Grn");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Item", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom")
                        .WithMany()
                        .HasForeignKey("BaseUomId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Brand", "Brand")
                        .WithMany()
                        .HasForeignKey("BrandId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Category", "Category")
                        .WithMany()
                        .HasForeignKey("CategoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor")
                        .WithMany()
                        .HasForeignKey("DefaultVendorId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory")
                        .WithMany()
                        .HasForeignKey("SubCategoryId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("BaseUom");

                    b.Navigation("Brand");

                    b.Navigation("Category");

                    b.Navigation("DefaultVendor");

                    b.Navigation("SubCategory");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany("ReorderSettings")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType")
                        .WithMany()
                        .HasForeignKey("LeaveTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Employee");

                    b.Navigation("LeaveType");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType")
                        .WithMany()
                        .HasForeignKey("LeaveTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Employee");

                    b.Navigation("LeaveType");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan")
                        .WithMany("Installments")
                        .HasForeignKey("EmployeeLoanId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun")
                        .WithMany()
                        .HasForeignKey("PayrollRunId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("EmployeeLoan");

                    b.Navigation("PayrollRun");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Employee", "Employee")
                        .WithMany()
                        .HasForeignKey("EmployeeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun")
                        .WithMany("Lines")
                        .HasForeignKey("PayrollRunId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Employee");

                    b.Navigation("PayrollRun");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine")
                        .WithMany("Components")
                        .HasForeignKey("PayrollLineId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent")
                        .WithMany()
                        .HasForeignKey("SalaryComponentId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("PayrollLine");

                    b.Navigation("SalaryComponent");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Branch", "Branch")
                        .WithMany()
                        .HasForeignKey("BranchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Branch");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine")
                        .WithOne()
                        .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("PayrollLine");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem")
                        .WithMany()
                        .HasForeignKey("NavItemId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem")
                        .WithMany()
                        .HasForeignKey("SubNavItemId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.Navigation("NavItem");

                    b.Navigation("SubNavItem");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder")
                        .WithMany("Lines")
                        .HasForeignKey("PoId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("PurchaseOrder");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser")
                        .WithMany()
                        .HasForeignKey("UpdatedBy")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("UpdatedByUser");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason")
                        .WithMany()
                        .HasForeignKey("CancelReasonCodeId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin")
                        .WithMany()
                        .HasForeignKey("OutputBinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template")
                        .WithMany("Runs")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CancelReason");

                    b.Navigation("Creator");

                    b.Navigation("OutputBin");

                    b.Navigation("Template");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition")
                        .WithMany()
                        .HasForeignKey("RequisitionId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor")
                        .WithMany()
                        .HasForeignKey("VendorId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("Requisition");

                    b.Navigation("Vendor");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode")
                        .WithMany()
                        .HasForeignKey("ReasonCodeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor")
                        .WithMany()
                        .HasForeignKey("VendorId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("ReasonCode");

                    b.Navigation("Vendor");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine")
                        .WithMany()
                        .HasForeignKey("GrnLineId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return")
                        .WithMany("Lines")
                        .HasForeignKey("ReturnId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("GrnLine");

                    b.Navigation("Item");

                    b.Navigation("Return");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Requester")
                        .WithMany()
                        .HasForeignKey("RequestedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Requester");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition")
                        .WithMany("Lines")
                        .HasForeignKey("RequisitionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("Requisition");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition")
                        .WithMany()
                        .HasForeignKey("RequisitionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Requisition");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq")
                        .WithMany("Lines")
                        .HasForeignKey("RfqId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("Rfq");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Permission", "Permission")
                        .WithMany()
                        .HasForeignKey("PermissionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Role", "Role")
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Permission");

                    b.Navigation("Role");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage")
                        .WithMany()
                        .HasForeignKey("ChildRunStageId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage")
                        .WithMany()
                        .HasForeignKey("ParentRunStageId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run")
                        .WithMany("Edges")
                        .HasForeignKey("RunId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("ChildRunStage");

                    b.Navigation("ParentRunStage");

                    b.Navigation("Run");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run")
                        .WithMany("Stages")
                        .HasForeignKey("RunId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage")
                        .WithMany()
                        .HasForeignKey("TemplateStageId")
                        .OnDelete(DeleteBehavior.SetNull);

                    b.Navigation("Run");

                    b.Navigation("TemplateStage");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run")
                        .WithMany("Events")
                        .HasForeignKey("RunId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage")
                        .WithMany("Events")
                        .HasForeignKey("RunStageId")
                        .OnDelete(DeleteBehavior.SetNull);

                    b.HasOne("ERPCore.Domain.Entities.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Run");

                    b.Navigation("RunStage");

                    b.Navigation("User");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput")
                        .WithMany()
                        .HasForeignKey("FromRunOutputId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage")
                        .WithMany("Inputs")
                        .HasForeignKey("RunStageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("FromRunOutput");

                    b.Navigation("Item");

                    b.Navigation("RunStage");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage")
                        .WithMany("Outputs")
                        .HasForeignKey("RunStageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason")
                        .WithMany()
                        .HasForeignKey("ScrapReasonCodeId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Uom", "Uom")
                        .WithMany()
                        .HasForeignKey("UomId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Item");

                    b.Navigation("RunStage");

                    b.Navigation("ScrapReason");

                    b.Navigation("Uom");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "CashierUser")
                        .WithMany()
                        .HasForeignKey("CashierUserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser")
                        .WithMany()
                        .HasForeignKey("ClosedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CashierUser");

                    b.Navigation("ClosedByUser");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatorUserId");

                    b.HasOne("ERPCore.Domain.Entities.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("Customer");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice")
                        .WithMany("Lines")
                        .HasForeignKey("SalesInvoiceId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("SalesInvoice");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode")
                        .WithMany()
                        .HasForeignKey("ReasonCodeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("Customer");

                    b.Navigation("ReasonCode");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return")
                        .WithMany("Lines")
                        .HasForeignKey("ReturnId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine")
                        .WithMany()
                        .HasForeignKey("SalesInvoiceLineId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Item");

                    b.Navigation("Return");

                    b.Navigation("SalesInvoiceLine");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "CashierUser")
                        .WithMany()
                        .HasForeignKey("CashierUserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd")
                        .WithMany("Slips")
                        .HasForeignKey("DayEndId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CashierUser");

                    b.Navigation("Customer");

                    b.Navigation("DayEnd");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip")
                        .WithMany("Lines")
                        .HasForeignKey("SalesSlipId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("SalesSlip");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage")
                        .WithMany()
                        .HasForeignKey("ChildStageId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage")
                        .WithMany()
                        .HasForeignKey("ParentStageId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template")
                        .WithMany("Edges")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("ChildStage");

                    b.Navigation("ParentStage");

                    b.Navigation("Template");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput")
                        .WithMany()
                        .HasForeignKey("FromOutputId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage")
                        .WithMany("Inputs")
                        .HasForeignKey("StageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("FromOutput");

                    b.Navigation("Item");

                    b.Navigation("Stage");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage")
                        .WithMany("Outputs")
                        .HasForeignKey("StageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Uom", "Uom")
                        .WithMany()
                        .HasForeignKey("UomId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Item");

                    b.Navigation("Stage");

                    b.Navigation("Uom");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode")
                        .WithMany()
                        .HasForeignKey("ReasonCodeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("ReasonCode");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment")
                        .WithMany("Lines")
                        .HasForeignKey("AdjustmentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Batch", null)
                        .WithMany()
                        .HasForeignKey("BatchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Bin", null)
                        .WithMany()
                        .HasForeignKey("BinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Serial", null)
                        .WithMany()
                        .HasForeignKey("SerialId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Adjustment");

                    b.Navigation("Item");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Bin", null)
                        .WithMany()
                        .HasForeignKey("BinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.StockCount", "Count")
                        .WithMany("Lines")
                        .HasForeignKey("CountId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Count");

                    b.Navigation("Item");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Batch", "Batch")
                        .WithMany()
                        .HasForeignKey("BatchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine")
                        .WithMany()
                        .HasForeignKey("GrnLineId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
                        .WithMany()
                        .HasForeignKey("SerialId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Batch");

                    b.Navigation("GrnLine");

                    b.Navigation("Item");

                    b.Navigation("Serial");

                    b.Navigation("Warehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Batch", null)
                        .WithMany()
                        .HasForeignKey("BatchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Bin", null)
                        .WithMany()
                        .HasForeignKey("BinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", null)
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Serial", null)
                        .WithMany()
                        .HasForeignKey("SerialId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.User", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", null)
                        .WithMany()
                        .HasForeignKey("WarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.User", "Creator")
                        .WithMany()
                        .HasForeignKey("CreatedBy")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse")
                        .WithMany()
                        .HasForeignKey("DestWarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse")
                        .WithMany()
                        .HasForeignKey("SrcWarehouseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Creator");

                    b.Navigation("DestWarehouse");

                    b.Navigation("SrcWarehouse");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Batch", null)
                        .WithMany()
                        .HasForeignKey("BatchId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Bin", null)
                        .WithMany()
                        .HasForeignKey("DestBinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Serial", null)
                        .WithMany()
                        .HasForeignKey("SerialId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.Bin", null)
                        .WithMany()
                        .HasForeignKey("SrcBinId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer")
                        .WithMany("Lines")
                        .HasForeignKey("TransferId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("Transfer");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Category", "Category")
                        .WithMany("SubCategories")
                        .HasForeignKey("CategoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Category");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem")
                        .WithMany("Children")
                        .HasForeignKey("NavItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("NavItem");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template")
                        .WithMany("Stages")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Template");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.User", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Role", "Role")
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Role");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq")
                        .WithMany("Quotations")
                        .HasForeignKey("RfqId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor")
                        .WithMany()
                        .HasForeignKey("VendorId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Rfq");

                    b.Navigation("Vendor");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b =>
                {
                    b.HasOne("ERPCore.Domain.Entities.Item", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation")
                        .WithMany("Lines")
                        .HasForeignKey("QuotationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("Quotation");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Category", b =>
                {
                    b.Navigation("SubCategories");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b =>
                {
                    b.Navigation("Installments");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b =>
                {
                    b.Navigation("Lines");

                    b.Navigation("Payments");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b =>
                {
                    b.Navigation("WarrantyNumbers");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Item", b =>
                {
                    b.Navigation("ReorderSettings");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b =>
                {
                    b.Navigation("Children");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b =>
                {
                    b.Navigation("Components");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b =>
                {
                    b.Navigation("Edges");

                    b.Navigation("Events");

                    b.Navigation("Stages");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b =>
                {
                    b.Navigation("Edges");

                    b.Navigation("Runs");

                    b.Navigation("Stages");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b =>
                {
                    b.Navigation("Lines");

                    b.Navigation("Quotations");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b =>
                {
                    b.Navigation("Events");

                    b.Navigation("Inputs");

                    b.Navigation("Outputs");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b =>
                {
                    b.Navigation("Slips");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b =>
                {
                    b.Navigation("Inputs");

                    b.Navigation("Outputs");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b =>
                {
                    b.Navigation("Lines");
                });

            modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b =>
                {
                    b.Navigation("Bins");
                });
#pragma warning restore 612, 618
        }
    }
}
