// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MilitaryTrainingManagement.Data;

#nullable disable

namespace MilitaryTrainingManagement.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    partial class ApplicationDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "8.0.0")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.AllocationDistribution", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<int>("AllocationId")
                        .HasColumnType("int");

                    b.Property<DateTime?>("ApprovedAt")
                        .HasColumnType("datetime2");

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

                    b.Property<bool>("IsApproved")
                        .HasColumnType("bit");

                    b.Property<DateTime?>("ReportedAt")
                        .HasColumnType("datetime2");

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

                    b.Property<int>("TargetUnitId")
                        .HasColumnType("int");

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

                    b.HasKey("Id");

                    b.HasIndex("AllocationId");

                    b.HasIndex("ApprovedByUserId");

                    b.HasIndex("ReportedByUserId");

                    b.HasIndex("TargetUnitId");

                    b.ToTable("AllocationDistributions");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.ApprovalRequest", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<string>("OriginalData")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Reason")
                        .IsRequired()
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

                    b.Property<DateTime>("RequestedAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("RequestedByUnitId")
                        .HasColumnType("int");

                    b.Property<int>("RequestedByUserId")
                        .HasColumnType("int");

                    b.Property<string>("RequestedChanges")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ReviewComments")
                        .HasColumnType("nvarchar(max)");

                    b.Property<DateTime?>("ReviewedAt")
                        .HasColumnType("datetime2");

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

                    b.Property<int>("Status")
                        .HasColumnType("int");

                    b.Property<int>("TargetEntityId")
                        .HasColumnType("int");

                    b.Property<int>("Type")
                        .HasColumnType("int");

                    b.HasKey("Id");

                    b.HasIndex("RequestedByUnitId");

                    b.HasIndex("RequestedByUserId");

                    b.HasIndex("ReviewedByUserId");

                    b.ToTable("ApprovalRequests");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.AuditLog", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<string>("Action")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<string>("ChangedFields")
                        .HasColumnType("nvarchar(max)");

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

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

                    b.Property<string>("EntityType")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("ErrorMessage")
                        .HasMaxLength(2000)
                        .HasColumnType("nvarchar(2000)");

                    b.Property<string>("IpAddress")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<bool>("IsSuccess")
                        .HasColumnType("bit");

                    b.Property<string>("NewValues")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("OldValues")
                        .HasColumnType("nvarchar(max)");

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

                    b.Property<string>("RequestPath")
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

                    b.Property<DateTime>("Timestamp")
                        .HasColumnType("datetime2");

                    b.Property<string>("UserAgent")
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

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

                    b.HasKey("Id");

                    b.HasIndex("Action");

                    b.HasIndex("EntityId");

                    b.HasIndex("EntityType");

                    b.HasIndex("OrganizationalUnitId");

                    b.HasIndex("Timestamp");

                    b.HasIndex("UserId");

                    b.ToTable("AuditLogs");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.ConsumptionReport", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<int>("AllocationDistributionId")
                        .HasColumnType("int");

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

                    b.Property<string>("Remarks")
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

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

                    b.Property<DateTime>("ReportedAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("ReportedByUnitId")
                        .HasColumnType("int");

                    b.Property<int>("ReportedByUserId")
                        .HasColumnType("int");

                    b.HasKey("Id");

                    b.HasIndex("AllocationDistributionId");

                    b.HasIndex("ReportedAt");

                    b.HasIndex("ReportedByUnitId");

                    b.HasIndex("ReportedByUserId");

                    b.ToTable("ConsumptionReports");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.ConsumptionReportChangeRequest", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<int>("ConsumptionReportId")
                        .HasColumnType("int");

                    b.Property<string>("ProcessComments")
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

                    b.Property<DateTime?>("ProcessedAt")
                        .HasColumnType("datetime2");

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

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

                    b.Property<string>("Reason")
                        .IsRequired()
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

                    b.Property<int>("RequestType")
                        .HasColumnType("int");

                    b.Property<DateTime>("RequestedAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("RequestedByUnitId")
                        .HasColumnType("int");

                    b.Property<int>("RequestedByUserId")
                        .HasColumnType("int");

                    b.Property<int>("Status")
                        .HasColumnType("int");

                    b.HasKey("Id");

                    b.HasIndex("ConsumptionReportId");

                    b.HasIndex("ProcessedByUnitId");

                    b.HasIndex("ProcessedByUserId");

                    b.HasIndex("RequestedByUnitId");

                    b.HasIndex("RequestedByUserId");

                    b.HasIndex("Status");

                    b.ToTable("ConsumptionReportChangeRequests");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.MaterialAllocation", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<string>("Category")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("CreatedByUnitId")
                        .HasColumnType("int");

                    b.Property<string>("MaterialName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

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

                    b.Property<string>("Unit")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("Id");

                    b.HasIndex("CreatedByUnitId");

                    b.ToTable("MaterialAllocations");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.MaterialCategory", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<string>("Description")
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

                    b.Property<bool>("IsActive")
                        .HasColumnType("bit");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

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

                    b.HasKey("Id");

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

                    b.ToTable("MaterialCategories");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("Level")
                        .HasColumnType("int");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

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

                    b.HasKey("Id");

                    b.HasIndex("ParentId");

                    b.ToTable("OrganizationalUnits");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.Personnel", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<string>("Achievements")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Age")
                        .HasColumnType("int");

                    b.Property<DateTime?>("ApprovedAt")
                        .HasColumnType("datetime2");

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

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

                    b.Property<string>("BirthDate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ContactInfo")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("EducationLevel")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("EnlistmentDate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Ethnicity")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Gender")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)");

                    b.Property<decimal?>("Height")
                        .HasPrecision(5, 2)
                        .HasColumnType("decimal(5,2)");

                    b.Property<string>("Hometown")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("IdNumber")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

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

                    b.Property<string>("PhotoPath")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("PoliticalStatus")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Position")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<string>("ProfessionalTitle")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Rank")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<string>("Specialty")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Status")
                        .HasColumnType("int");

                    b.Property<DateTime>("SubmittedAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("SubmittedByUnitId")
                        .HasColumnType("int");

                    b.Property<string>("SupportingDocuments")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("TrainingParticipation")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Unit")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("Id");

                    b.HasIndex("ApprovedByUnitId");

                    b.HasIndex("PendingUpgradeByUnitId");

                    b.HasIndex("SubmittedByUnitId");

                    b.ToTable("Personnel");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.PersonnelApprovalHistory", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<int>("Action")
                        .HasColumnType("int");

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)");

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

                    b.Property<int>("NewStatus")
                        .HasColumnType("int");

                    b.Property<int>("PersonnelId")
                        .HasColumnType("int");

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

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

                    b.Property<DateTime>("ReviewedAt")
                        .HasColumnType("datetime2");

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

                    b.Property<int>("ReviewedByUserId")
                        .HasColumnType("int");

                    b.HasKey("Id");

                    b.HasIndex("PersonnelId");

                    b.HasIndex("ReviewedByUnitId");

                    b.HasIndex("ReviewedByUserId");

                    b.ToTable("PersonnelApprovalHistories");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.UserAccount", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<string>("DisplayName")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<bool>("IsActive")
                        .HasColumnType("bit");

                    b.Property<DateTime?>("LastLoginAt")
                        .HasColumnType("datetime2");

                    b.Property<int>("OrganizationalUnitId")
                        .HasColumnType("int");

                    b.Property<string>("PasswordHash")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("PlainPassword")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Username")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("Id");

                    b.HasIndex("OrganizationalUnitId");

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

                    b.ToTable("UserAccounts");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.AllocationDistribution", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.MaterialAllocation", "Allocation")
                        .WithMany("Distributions")
                        .HasForeignKey("AllocationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "ApprovedByUser")
                        .WithMany()
                        .HasForeignKey("ApprovedByUserId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "ReportedByUser")
                        .WithMany()
                        .HasForeignKey("ReportedByUserId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "TargetUnit")
                        .WithMany()
                        .HasForeignKey("TargetUnitId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Allocation");

                    b.Navigation("ApprovedByUser");

                    b.Navigation("ReportedByUser");

                    b.Navigation("TargetUnit");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.ApprovalRequest", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "RequestedByUnit")
                        .WithMany()
                        .HasForeignKey("RequestedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "RequestedByUser")
                        .WithMany()
                        .HasForeignKey("RequestedByUserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "ReviewedByUser")
                        .WithMany()
                        .HasForeignKey("ReviewedByUserId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.Navigation("RequestedByUnit");

                    b.Navigation("RequestedByUser");

                    b.Navigation("ReviewedByUser");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.AuditLog", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "OrganizationalUnit")
                        .WithMany()
                        .HasForeignKey("OrganizationalUnitId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.Navigation("OrganizationalUnit");

                    b.Navigation("User");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.ConsumptionReport", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.AllocationDistribution", "AllocationDistribution")
                        .WithMany()
                        .HasForeignKey("AllocationDistributionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "ReportedByUnit")
                        .WithMany()
                        .HasForeignKey("ReportedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "ReportedByUser")
                        .WithMany()
                        .HasForeignKey("ReportedByUserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("AllocationDistribution");

                    b.Navigation("ReportedByUnit");

                    b.Navigation("ReportedByUser");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.ConsumptionReportChangeRequest", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.ConsumptionReport", "ConsumptionReport")
                        .WithMany()
                        .HasForeignKey("ConsumptionReportId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "ProcessedByUnit")
                        .WithMany()
                        .HasForeignKey("ProcessedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "ProcessedByUser")
                        .WithMany()
                        .HasForeignKey("ProcessedByUserId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "RequestedByUnit")
                        .WithMany()
                        .HasForeignKey("RequestedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "RequestedByUser")
                        .WithMany()
                        .HasForeignKey("RequestedByUserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("ConsumptionReport");

                    b.Navigation("ProcessedByUnit");

                    b.Navigation("ProcessedByUser");

                    b.Navigation("RequestedByUnit");

                    b.Navigation("RequestedByUser");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.MaterialAllocation", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "CreatedByUnit")
                        .WithMany()
                        .HasForeignKey("CreatedByUnitId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CreatedByUnit");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "Parent")
                        .WithMany("Children")
                        .HasForeignKey("ParentId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Parent");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.Personnel", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "ApprovedByUnit")
                        .WithMany()
                        .HasForeignKey("ApprovedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "PendingUpgradeByUnit")
                        .WithMany()
                        .HasForeignKey("PendingUpgradeByUnitId");

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "SubmittedByUnit")
                        .WithMany()
                        .HasForeignKey("SubmittedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("ApprovedByUnit");

                    b.Navigation("PendingUpgradeByUnit");

                    b.Navigation("SubmittedByUnit");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.PersonnelApprovalHistory", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.Personnel", "Personnel")
                        .WithMany()
                        .HasForeignKey("PersonnelId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "ReviewedByUnit")
                        .WithMany()
                        .HasForeignKey("ReviewedByUnitId")
                        .OnDelete(DeleteBehavior.NoAction);

                    b.HasOne("MilitaryTrainingManagement.Models.Entities.UserAccount", "ReviewedByUser")
                        .WithMany()
                        .HasForeignKey("ReviewedByUserId")
                        .OnDelete(DeleteBehavior.NoAction)
                        .IsRequired();

                    b.Navigation("Personnel");

                    b.Navigation("ReviewedByUnit");

                    b.Navigation("ReviewedByUser");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.UserAccount", b =>
                {
                    b.HasOne("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", "OrganizationalUnit")
                        .WithMany("Accounts")
                        .HasForeignKey("OrganizationalUnitId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("OrganizationalUnit");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.MaterialAllocation", b =>
                {
                    b.Navigation("Distributions");
                });

            modelBuilder.Entity("MilitaryTrainingManagement.Models.Entities.OrganizationalUnit", b =>
                {
                    b.Navigation("Accounts");

                    b.Navigation("Children");
                });
#pragma warning restore 612, 618
        }
    }
}
