//
using System;
using ContactManagementAPI.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace ContactManagementAPI.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("ContactManagementAPI.Models.AppUser", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("FullName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property("GroupId")
.HasColumnType("int");
b.Property("IsActive")
.HasColumnType("bit");
b.Property("IsAdmin")
.HasColumnType("bit");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("UpdatedAt")
.HasColumnType("datetime2");
b.Property("UserName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.HasIndex("GroupId");
b.HasIndex("UserName")
.IsUnique();
b.ToTable("AppUsers");
});
modelBuilder.Entity("ContactManagementAPI.Models.Contact", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("AadharNumber")
.HasColumnType("nvarchar(max)");
b.Property("Address")
.HasColumnType("nvarchar(max)");
b.Property("BankAccountNumber")
.HasColumnType("nvarchar(max)");
b.Property("BankName")
.HasColumnType("nvarchar(max)");
b.Property("BranchName")
.HasColumnType("nvarchar(max)");
b.Property("City")
.HasColumnType("nvarchar(max)");
b.Property("Country")
.HasColumnType("nvarchar(max)");
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("DateOfBirth")
.HasColumnType("datetime2");
b.Property("DrivingLicenseNumber")
.HasColumnType("nvarchar(max)");
b.Property("Email")
.HasColumnType("nvarchar(max)");
b.Property("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Gender")
.HasColumnType("nvarchar(max)");
b.Property("GroupId")
.HasColumnType("int");
b.Property("IfscCode")
.HasColumnType("nvarchar(max)");
b.Property("LastName")
.HasColumnType("nvarchar(max)");
b.Property("Mobile1")
.HasColumnType("nvarchar(max)");
b.Property("Mobile2")
.HasColumnType("nvarchar(max)");
b.Property("Mobile3")
.HasColumnType("nvarchar(max)");
b.Property("NickName")
.HasColumnType("nvarchar(max)");
b.Property("OtherDetails")
.HasColumnType("nvarchar(max)");
b.Property("PanNumber")
.HasColumnType("nvarchar(max)");
b.Property("PassportNumber")
.HasColumnType("nvarchar(max)");
b.Property("PhotoPath")
.HasColumnType("nvarchar(max)");
b.Property("PostalCode")
.HasColumnType("nvarchar(max)");
b.Property("State")
.HasColumnType("nvarchar(max)");
b.Property("UpdatedAt")
.HasColumnType("datetime2");
b.Property("VotersId")
.HasColumnType("nvarchar(max)");
b.Property("WhatsAppNumber")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("GroupId");
b.ToTable("Contacts");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactBankAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("AccountNumber")
.HasColumnType("nvarchar(max)");
b.Property("BankName")
.HasColumnType("nvarchar(max)");
b.Property("BranchName")
.HasColumnType("nvarchar(max)");
b.Property("ContactId")
.HasColumnType("int");
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("IfscCode")
.HasColumnType("nvarchar(max)");
b.Property("UpdatedAt")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("ContactBankAccounts");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactDocument", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ContactId")
.HasColumnType("int");
b.Property("ContentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DocumentPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DocumentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileSize")
.HasColumnType("bigint");
b.Property("UploadedAt")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("ContactDocuments");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("ContactGroups");
b.HasData(
new
{
Id = 1,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7176),
Description = "Family members",
Name = "Family"
},
new
{
Id = 2,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7190),
Description = "Friends",
Name = "Friends"
},
new
{
Id = 3,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7192),
Description = "Business contacts",
Name = "Business"
},
new
{
Id = 4,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7196),
Description = "School contacts",
Name = "School"
},
new
{
Id = 5,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7198),
Description = "Church members",
Name = "Church"
},
new
{
Id = 6,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7199),
Description = "Other contacts",
Name = "Others"
},
new
{
Id = 7,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7200),
Description = "College contacts",
Name = "College"
},
new
{
Id = 8,
CreatedAt = new DateTime(2026, 2, 21, 10, 27, 31, 12, DateTimeKind.Local).AddTicks(7202),
Description = "Alcoholics Anonymous",
Name = "AA"
});
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactPhoto", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ContactId")
.HasColumnType("int");
b.Property("ContentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileSize")
.HasColumnType("bigint");
b.Property("IsProfilePhoto")
.HasColumnType("bit");
b.Property("PhotoPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("UploadedAt")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("ContactPhotos");
});
modelBuilder.Entity("ContactManagementAPI.Models.GroupRight", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("IsGranted")
.HasColumnType("bit");
b.Property("RightKey")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property("UserGroupId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserGroupId", "RightKey")
.IsUnique();
b.ToTable("GroupRights");
});
modelBuilder.Entity("ContactManagementAPI.Models.UserGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("Description")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("UserGroups");
});
modelBuilder.Entity("ContactManagementAPI.Models.UserRight", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("AppUserId")
.HasColumnType("int");
b.Property("IsGranted")
.HasColumnType("bit");
b.Property("RightKey")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.HasIndex("AppUserId", "RightKey")
.IsUnique();
b.ToTable("UserRights");
});
modelBuilder.Entity("ContactManagementAPI.Models.AppUser", b =>
{
b.HasOne("ContactManagementAPI.Models.UserGroup", "Group")
.WithMany("Users")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.SetNull)
.IsRequired();
b.Navigation("Group");
});
modelBuilder.Entity("ContactManagementAPI.Models.Contact", b =>
{
b.HasOne("ContactManagementAPI.Models.ContactGroup", "Group")
.WithMany("Contacts")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Group");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactBankAccount", b =>
{
b.HasOne("ContactManagementAPI.Models.Contact", "Contact")
.WithMany("BankAccounts")
.HasForeignKey("ContactId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contact");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactDocument", b =>
{
b.HasOne("ContactManagementAPI.Models.Contact", "Contact")
.WithMany("Documents")
.HasForeignKey("ContactId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contact");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactPhoto", b =>
{
b.HasOne("ContactManagementAPI.Models.Contact", "Contact")
.WithMany("Photos")
.HasForeignKey("ContactId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contact");
});
modelBuilder.Entity("ContactManagementAPI.Models.GroupRight", b =>
{
b.HasOne("ContactManagementAPI.Models.UserGroup", "UserGroup")
.WithMany("GroupRights")
.HasForeignKey("UserGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserGroup");
});
modelBuilder.Entity("ContactManagementAPI.Models.UserRight", b =>
{
b.HasOne("ContactManagementAPI.Models.AppUser", "AppUser")
.WithMany("UserRights")
.HasForeignKey("AppUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AppUser");
});
modelBuilder.Entity("ContactManagementAPI.Models.AppUser", b =>
{
b.Navigation("UserRights");
});
modelBuilder.Entity("ContactManagementAPI.Models.Contact", b =>
{
b.Navigation("BankAccounts");
b.Navigation("Documents");
b.Navigation("Photos");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactGroup", b =>
{
b.Navigation("Contacts");
});
modelBuilder.Entity("ContactManagementAPI.Models.UserGroup", b =>
{
b.Navigation("GroupRights");
b.Navigation("Users");
});
#pragma warning restore 612, 618
}
}
}