using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace OnlineAssessment.Domain.Models
{
    public partial class OnlineAssessmentContext : DbContext
    {

        public OnlineAssessmentContext(DbContextOptions<OnlineAssessmentContext> options)
            : base(options)
        {
        }

        public virtual DbSet<ActivityLogs> ActivityLogs { get; set; }
        public virtual DbSet<BookmarkedExams> BookmarkedExams { get; set; }
        public virtual DbSet<BookmarkedPractices> BookmarkedPractices { get; set; }
        public virtual DbSet<BookmarkedQuestions> BookmarkedQuestions { get; set; }
        public virtual DbSet<Categories> Categories { get; set; }
        public virtual DbSet<Classes> Classes { get; set; }
        public virtual DbSet<ContactLogs> ContactLogs { get; set; }
        public virtual DbSet<ErrorLogs> ErrorLogs { get; set; }
        public virtual DbSet<ExamAttempts> ExamAttempts { get; set; }
        public virtual DbSet<ExamAttemptsAnswer> ExamAttemptsAnswer { get; set; }
        public virtual DbSet<ExamAttemptsAssessment> ExamAttemptsAssessment { get; set; }
        public virtual DbSet<ExamQuestionsMarkWeight> ExamQuestionsMarkWeight { get; set; }
        public virtual DbSet<ExamSections> ExamSections { get; set; }
        public virtual DbSet<ExamTypes> ExamTypes { get; set; }
        public virtual DbSet<Exams> Exams { get; set; }
        public virtual DbSet<Institutes> Institutes { get; set; }
        public virtual DbSet<Languages> Languages { get; set; }
        public virtual DbSet<ModuleRoles> ModuleRoles { get; set; }
        public virtual DbSet<Modules> Modules { get; set; }
        public virtual DbSet<OrderPayment> OrderPayment { get; set; }
        public virtual DbSet<Orders> Orders { get; set; }
        public virtual DbSet<PasswordReset> PasswordReset { get; set; }
        public virtual DbSet<Plans> Plans { get; set; }
        public virtual DbSet<PracticeAttemptAnswers> PracticeAttemptAnswers { get; set; }
        public virtual DbSet<PracticeAttempts> PracticeAttempts { get; set; }
        public virtual DbSet<PracticeQuestions> PracticeQuestions { get; set; }
        public virtual DbSet<Practices> Practices { get; set; }
        public virtual DbSet<QuestionBugs> QuestionBugs { get; set; }
        public virtual DbSet<QuestionCategories> QuestionCategories { get; set; }
        public virtual DbSet<QuestionLanguges> QuestionLanguges { get; set; }
        public virtual DbSet<QuestionOptionLanguages> QuestionOptionLanguages { get; set; }
        public virtual DbSet<QuestionOptions> QuestionOptions { get; set; }
        public virtual DbSet<QuestionTags> QuestionTags { get; set; }
        public virtual DbSet<QuestionTypes> QuestionTypes { get; set; }
        public virtual DbSet<Questions> Questions { get; set; }
        public virtual DbSet<Roles> Roles { get; set; }
        public virtual DbSet<States> States { get; set; }
        public virtual DbSet<Subjects> Subjects { get; set; }
        public virtual DbSet<SubscribedExams> SubscribedExams { get; set; }
        public virtual DbSet<SubscribedPractices> SubscribedPractices { get; set; }
        public virtual DbSet<Subscriptions> Subscriptions { get; set; }
        public virtual DbSet<Tags> Tags { get; set; }
        public virtual DbSet<UserGroupExams> UserGroupExams { get; set; }
        public virtual DbSet<UserGroupMembers> UserGroupMembers { get; set; }
        public virtual DbSet<UserGroupPractices> UserGroupPractices { get; set; }
        public virtual DbSet<UserGroups> UserGroups { get; set; }
        public virtual DbSet<UserLogs> UserLogs { get; set; }
        public virtual DbSet<Users> Users { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                /*
                 
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlServer("Server=68.71.130.74,1533;Database=odiproj1_oa;User ID=oa;Password=OdiOdi@1234;");

                */
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("Relational:DefaultSchema", "oa");

            modelBuilder.Entity<ActivityLogs>(entity =>
            {
                entity.ToTable("ActivityLogs", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Action)
                    .HasColumnName("action")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.ActionDate)
                    .HasColumnName("action_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Item)
                    .HasColumnName("item")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.ItemType)
                    .HasColumnName("item_type")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.ActivityLogs)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ActivityLogs_User");
            });

            modelBuilder.Entity<BookmarkedExams>(entity =>
            {
                entity.ToTable("BookmarkedExams", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BookmarkDate)
                    .HasColumnName("bookmark_date")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExamId).HasColumnName("exam_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.Exam)
                    .WithMany(p => p.BookmarkedExams)
                    .HasForeignKey(d => d.ExamId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedExams_Exam");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.BookmarkedExams)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedExams_User");
            });

            modelBuilder.Entity<BookmarkedPractices>(entity =>
            {
                entity.ToTable("BookmarkedPractices", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BookmarkDate)
                    .HasColumnName("bookmark_date")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.PracticeId).HasColumnName("practice_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.Practice)
                    .WithMany(p => p.BookmarkedPractices)
                    .HasForeignKey(d => d.PracticeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedPractices_Practice");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.BookmarkedPractices)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedPractices_User");
            });

            modelBuilder.Entity<BookmarkedQuestions>(entity =>
            {
                entity.ToTable("BookmarkedQuestions", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BookmarkDate)
                    .HasColumnName("bookmark_date")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.BookmarkedQuestions)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedQuestions_Question");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.BookmarkedQuestions)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedQuestions_User");
            });

            modelBuilder.Entity<Categories>(entity =>
            {
                entity.ToTable("Categories", "dbo");

                entity.HasIndex(e => new { e.SubjectId, e.Name, e.IsActive })
                    .HasName("UNIQUE_Categories_name")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500);

                entity.Property(e => e.SubjectId).HasColumnName("subject_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.Weightage).HasColumnName("weightage");

                entity.HasOne(d => d.Subject)
                    .WithMany(p => p.Categories)
                    .HasForeignKey(d => d.SubjectId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_CategoriesSubject");
            });

            modelBuilder.Entity<Classes>(entity =>
            {
                entity.ToTable("Classes", "dbo");

                entity.HasIndex(e => new { e.InstituteId, e.Name, e.IsActive })
                    .HasName("UNIQUE_Classes_name")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.Classes)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Classes_Institute");
            });

            modelBuilder.Entity<ContactLogs>(entity =>
            {
                entity.ToTable("ContactLogs", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Comment)
                    .HasColumnName("comment")
                    .IsUnicode(false);

                entity.Property(e => e.ContactBy)
                    .IsRequired()
                    .HasColumnName("contact_by")
                    .HasMaxLength(150)
                    .IsUnicode(false);

                entity.Property(e => e.ContactDate)
                    .HasColumnName("contact_date")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ContactFor)
                    .IsRequired()
                    .HasColumnName("contact_for")
                    .HasMaxLength(150)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.EmailFrom)
                    .IsRequired()
                    .HasColumnName("email_from")
                    .HasMaxLength(150)
                    .IsUnicode(false);

                entity.Property(e => e.EmailMessage)
                    .IsRequired()
                    .HasColumnName("email_message")
                    .IsUnicode(false);

                entity.Property(e => e.EmailSubject)
                    .IsRequired()
                    .HasColumnName("email_subject")
                    .HasMaxLength(250)
                    .IsUnicode(false);

                entity.Property(e => e.EmailTo)
                    .IsRequired()
                    .HasColumnName("email_to")
                    .HasMaxLength(150)
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.ReplyBy).HasColumnName("reply_by");

                entity.Property(e => e.ReplyDate)
                    .HasColumnName("reply_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<ErrorLogs>(entity =>
            {
                entity.ToTable("ErrorLogs", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Environment)
                    .HasColumnName("environment")
                    .IsUnicode(false);

                entity.Property(e => e.ErrorCallStack)
                    .HasColumnName("error_call_stack")
                    .IsUnicode(false);

                entity.Property(e => e.ErrorDate)
                    .HasColumnName("error_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.ErrorInnerMessage)
                    .HasColumnName("error_inner_message")
                    .IsUnicode(false);

                entity.Property(e => e.ErrorMessage)
                    .HasColumnName("error_message")
                    .IsUnicode(false);

                entity.Property(e => e.ErrorPage)
                    .HasColumnName("error_page")
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Language)
                    .HasColumnName("language")
                    .IsUnicode(false);

                entity.Property(e => e.TargetSite)
                    .HasColumnName("target_site")
                    .IsUnicode(false);

                entity.Property(e => e.TheClass)
                    .HasColumnName("the_class")
                    .IsUnicode(false);

                entity.Property(e => e.TicketNo)
                    .HasColumnName("ticket_no")
                    .IsUnicode(false);

                entity.Property(e => e.TypeLog)
                    .HasColumnName("type_log")
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserAgent)
                    .HasColumnName("user_agent")
                    .IsUnicode(false);

                entity.Property(e => e.UserDomain)
                    .HasColumnName("user_domain")
                    .IsUnicode(false);

                entity.Property(e => e.UserId).HasColumnName("user_id");
            });

            modelBuilder.Entity<ExamAttempts>(entity =>
            {
                entity.ToTable("ExamAttempts", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AverageTimeSeconds).HasColumnName("average_time_seconds");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExamId).HasColumnName("exam_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LastPausedAt)
                    .HasColumnName("last_paused_at")
                    .HasColumnType("datetime");

                entity.Property(e => e.PuasedPeriod)
                    .HasColumnName("puased_period")
                    .IsUnicode(false);

                entity.Property(e => e.RemainingTimeSeconds).HasColumnName("remaining_time_seconds");

                entity.Property(e => e.Score).HasColumnName("score");

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Exam)
                    .WithMany(p => p.ExamAttempts)
                    .HasForeignKey(d => d.ExamId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamAttempts_Exam");
            });

            modelBuilder.Entity<ExamAttemptsAnswer>(entity =>
            {
                entity.ToTable("ExamAttemptsAnswer", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AnswerDurationSeconds).HasColumnName("answer_duration_seconds");

                entity.Property(e => e.DateOfAnswer)
                    .HasColumnName("date_of_answer")
                    .HasColumnType("datetime");

                entity.Property(e => e.Doubt)
                    .HasColumnName("doubt")
                    .IsUnicode(false);

                entity.Property(e => e.ExamAttemptId).HasColumnName("exam_attempt_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsCorrect).HasColumnName("is_correct");

                entity.Property(e => e.IsReviewed)
                    .HasColumnName("is_reviewed")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsVisited)
                    .HasColumnName("is_visited")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.Score).HasColumnName("score");

                entity.Property(e => e.StudentAnswer)
                    .HasColumnName("student_answer")
                    .IsUnicode(false);

                entity.HasOne(d => d.ExamAttempt)
                    .WithMany(p => p.ExamAttemptsAnswer)
                    .HasForeignKey(d => d.ExamAttemptId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamAttemptsAnswer_ExamAttempt");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.ExamAttemptsAnswer)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamAttemptsAnswer_Question");
            });

            modelBuilder.Entity<ExamAttemptsAssessment>(entity =>
            {
                entity.ToTable("ExamAttemptsAssessment", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Assessement)
                    .HasColumnName("assessement")
                    .IsUnicode(false);

                entity.Property(e => e.Correctness)
                    .HasColumnName("correctness")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.DateOfAnswer)
                    .HasColumnName("date_of_answer")
                    .HasColumnType("datetime");

                entity.Property(e => e.ExamSectionId).HasColumnName("exam_section_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.StudentAnswer)
                    .HasColumnName("student_answer")
                    .IsUnicode(false);

                entity.Property(e => e.TimeTakenToAnswerInSeconds).HasColumnName("time_taken_to_answer_in_seconds");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.ExamSection)
                    .WithMany(p => p.ExamAttemptsAssessment)
                    .HasForeignKey(d => d.ExamSectionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamAttemptsAssessment_ExamSection");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.ExamAttemptsAssessment)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamAttemptsAssessment_Question");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.ExamAttemptsAssessment)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamAttemptsAssessment_User");
            });

            modelBuilder.Entity<ExamQuestionsMarkWeight>(entity =>
            {
                entity.ToTable("ExamQuestionsMarkWeight", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExamSectionId).HasColumnName("exam_section_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.MarkForCorrectAnswer).HasColumnName("mark_for_correct_answer");

                entity.Property(e => e.MarkForWrongAnswer).HasColumnName("mark_for_wrong_answer");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.QuestionSequence).HasColumnName("question_sequence");

                entity.Property(e => e.TotalMarks).HasColumnName("total_marks");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.ExamSection)
                    .WithMany(p => p.ExamQuestionsMarkWeight)
                    .HasForeignKey(d => d.ExamSectionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamQuestionsMarkWeight_ExamSection");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.ExamQuestionsMarkWeight)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamQuestionsMarkWeight_Question");
            });

            modelBuilder.Entity<ExamSections>(entity =>
            {
                entity.ToTable("ExamSections", "dbo");

                entity.HasIndex(e => new { e.ExamId, e.SubjectId, e.IsActive })
                    .HasName("UNIQUE_ExamSections")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExamId).HasColumnName("exam_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasMaxLength(15)
                    .IsUnicode(false);

                entity.Property(e => e.SubjectDuration).HasColumnName("subject_duration");

                entity.Property(e => e.SubjectId).HasColumnName("subject_id");

                entity.Property(e => e.SubjectSequence).HasColumnName("subject_sequence");

                entity.Property(e => e.TotalMarks).HasColumnName("total_marks");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.Exam)
                    .WithMany(p => p.ExamSections)
                    .HasForeignKey(d => d.ExamId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamSections_Exam");

                entity.HasOne(d => d.Subject)
                    .WithMany(p => p.ExamSections)
                    .HasForeignKey(d => d.SubjectId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamSections_Subject");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.ExamSections)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamSections_User");
            });

            modelBuilder.Entity<ExamTypes>(entity =>
            {
                entity.ToTable("ExamTypes", "dbo");

                entity.HasIndex(e => e.Code)
                    .HasName("UQ__ExamType__357D4CF9B4C9274B")
                    .IsUnique();

                entity.HasIndex(e => e.Name)
                    .HasName("UQ__ExamType__72E12F1B356797AC")
                    .IsUnique();

                entity.HasIndex(e => new { e.IsActive, e.Code, e.Name })
                    .HasName("UNIQUE_ExamTypes")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Code)
                    .HasColumnName("code")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description)
                    .HasColumnName("description")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<Exams>(entity =>
            {
                entity.ToTable("Exams", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AttemptsAllowed).HasColumnName("attempts_allowed");

                entity.Property(e => e.ClassId).HasColumnName("class_id");

                entity.Property(e => e.Complexity).HasColumnName("complexity");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.CreditsNeeded)
                    .HasColumnName("credits_needed")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.ExamCloseDatetime)
                    .HasColumnName("exam_close_datetime")
                    .HasColumnType("datetime");

                entity.Property(e => e.ExamDurationInSeconds).HasColumnName("exam_duration_in_seconds");

                entity.Property(e => e.ExamOpenDatetime)
                    .HasColumnName("exam_open_datetime")
                    .HasColumnType("datetime");

                entity.Property(e => e.ExamStatus)
                    .IsRequired()
                    .HasColumnName("exam_status")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.ExamTypeId).HasColumnName("exam_type_id");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.Instruction).HasColumnName("instruction").HasColumnType("NVARCHAR(MAX)");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsRandomQuestion)
                    .HasColumnName("is_random_question")
                    .HasMaxLength(1)
                    .IsUnicode(false)
                    .HasDefaultValueSql("('Y')");

                entity.Property(e => e.LanguageId).HasColumnName("language_id");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.Photo)
                    .HasColumnName("photo")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.TotalMarks).HasColumnName("total_marks");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.Exams)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Exams_CreatedByUser");

                entity.HasOne(d => d.ExamType)
                    .WithMany(p => p.Exams)
                    .HasForeignKey(d => d.ExamTypeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Exams_Type");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.Exams)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Exams_Institutes");
            });

            modelBuilder.Entity<Institutes>(entity =>
            {
                entity.ToTable("Institutes", "dbo");

                entity.HasIndex(e => e.Name)
                    .HasName("UNIQUE_Institute_name")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Address)
                    .HasColumnName("address")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.ApiKey)
                    .HasColumnName("api_key")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.City)
                    .HasColumnName("city")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.Country)
                    .HasColumnName("country")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.DateOfEstablishment)
                    .HasColumnName("date_of_establishment")
                    .HasColumnType("datetime");

                entity.Property(e => e.Domain)
                    .HasColumnName("domain")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.ImageUrlLarge)
                    .HasColumnName("image_url_large")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.ImageUrlSmall)
                    .HasColumnName("image_url_small")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Logo)
                    .HasColumnName("logo")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.PinCode)
                    .HasColumnName("pin_code")
                    .HasMaxLength(6)
                    .IsUnicode(false);

                entity.Property(e => e.StateId).HasColumnName("state_id");

                entity.Property(e => e.SubscriptionId).HasColumnName("subscription_id");

                entity.Property(e => e.Theme)
                    .HasColumnName("theme")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.State)
                    .WithMany(p => p.Institutes)
                    .HasForeignKey(d => d.StateId)
                    .HasConstraintName("FK_Institute_State");

                entity.HasOne(d => d.Subscription)
                    .WithMany(p => p.Institutes)
                    .HasForeignKey(d => d.SubscriptionId)
                    .HasConstraintName("FK_Institute_Subscription");
            });

            modelBuilder.Entity<Languages>(entity =>
            {
                entity.ToTable("Languages", "dbo");

                entity.HasIndex(e => e.Code)
                    .HasName("UNIQUE_Language_code")
                    .IsUnique();

                entity.HasIndex(e => new { e.Code, e.Name })
                    .HasName("UNIQUE_Language_code_name")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Code)
                    .IsRequired()
                    .HasColumnName("code")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<ModuleRoles>(entity =>
            {
                entity.ToTable("ModuleRoles", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsAdd)
                    .HasColumnName("is_add")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsDelete)
                    .HasColumnName("is_delete")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.IsEdit)
                    .HasColumnName("is_edit")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsView)
                    .HasColumnName("is_view")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.ModuleId).HasColumnName("module_id");

                entity.Property(e => e.Name)
                    .HasColumnName("name")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.RoleId).HasColumnName("role_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.ModuleRoles)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ModuleRoles_institute");

                entity.HasOne(d => d.Module)
                    .WithMany(p => p.ModuleRoles)
                    .HasForeignKey(d => d.ModuleId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ModuleRoles_module");

                entity.HasOne(d => d.Role)
                    .WithMany(p => p.ModuleRoles)
                    .HasForeignKey(d => d.RoleId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ModuleRoles_Roles");
            });

            modelBuilder.Entity<Modules>(entity =>
            {
                entity.ToTable("Modules", "dbo");

                entity.HasIndex(e => e.Name)
                    .HasName("UNIQUE_Modules_name")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description)
                    .HasColumnName("description")
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<OrderPayment>(entity =>
            {
                entity.ToTable("OrderPayment", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.PgOrderId).HasColumnName("pg_order_id");

                entity.Property(e => e.PlanId).HasColumnName("plan_id");

                entity.Property(e => e.Price).HasColumnName("price");

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.OrderPaymentCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_OrderPayment_CreatedByUser");

                entity.HasOne(d => d.Plan)
                    .WithMany(p => p.OrderPayment)
                    .HasForeignKey(d => d.PlanId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_OrderPayment_Plans");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.OrderPaymentUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_OrderPayment_UpdatedByUser");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.OrderPaymentUser)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_OrderPayment_Users");
            });

            modelBuilder.Entity<Orders>(entity =>
            {
                entity.ToTable("Orders", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Amount).HasColumnName("amount");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.DiscountId).HasColumnName("discount_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.OrderId)
                    .IsRequired()
                    .HasColumnName("order_id")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.PlanId).HasColumnName("plan_id");

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.OrdersCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Orders_CreatedByUser");

                entity.HasOne(d => d.Plan)
                    .WithMany(p => p.Orders)
                    .HasForeignKey(d => d.PlanId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Orders_Plans");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.OrdersUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Orders_UpdatedByUser");
            });

            modelBuilder.Entity<PasswordReset>(entity =>
            {
                entity.ToTable("PasswordReset", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AuthKey).HasColumnName("auth_key");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.GeneratedForUserId).HasColumnName("generated_for_user_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsExpired)
                    .HasColumnName("is_expired")
                    .HasMaxLength(1)
                    .IsUnicode(false)
                    .IsFixedLength()
                    .HasDefaultValueSql("('N')");

                entity.Property(e => e.ResetedOn)
                    .HasColumnName("reseted_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.GeneratedForUser)
                    .WithMany(p => p.PasswordReset)
                    .HasForeignKey(d => d.GeneratedForUserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PasswordReset_User");
            });

            modelBuilder.Entity<Plans>(entity =>
            {
                entity.ToTable("Plans", "dbo");

                entity.HasIndex(e => e.Code)
                    .HasName("UQ__Plans__357D4CF936294879")
                    .IsUnique();

                entity.HasIndex(e => e.Name)
                    .HasName("UNIQUE_Plans_name")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Code)
                    .IsRequired()
                    .HasColumnName("code")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description)
                    .HasColumnName("description")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.DurationDays)
                    .HasColumnName("duration_days")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.FinalPrice)
                    .HasColumnName("final_price")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.Image)
                    .HasColumnName("image")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.InitialPrice)
                    .HasColumnName("initial_price")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.PaidExams)
                    .HasColumnName("paid_exams")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.PaidPractices)
                    .HasColumnName("paid_practices")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.Plans)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK__Plans__institute__6B09B2FB");
            });

            modelBuilder.Entity<PracticeAttemptAnswers>(entity =>
            {
                entity.ToTable("PracticeAttemptAnswers", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AnswerDurationSeconds).HasColumnName("answer_duration_seconds");

                entity.Property(e => e.Correctness).HasColumnName("correctness");

                entity.Property(e => e.DateOfAnswer)
                    .HasColumnName("date_of_answer")
                    .HasColumnType("datetime");

                entity.Property(e => e.Doubt)
                    .HasColumnName("doubt")
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsVisited).HasColumnName("is_visited");

                entity.Property(e => e.PracticeAttemptId).HasColumnName("practice_attempt_id");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.StudentAnswer)
                    .HasColumnName("student_answer")
                    .IsUnicode(false);

                entity.HasOne(d => d.PracticeAttempt)
                    .WithMany(p => p.PracticeAttemptAnswers)
                    .HasForeignKey(d => d.PracticeAttemptId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeAttemptAnswers_PracticeAttempts");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.PracticeAttemptAnswers)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeAttemptAnswers_Questions");
            });

            modelBuilder.Entity<PracticeAttempts>(entity =>
            {
                entity.ToTable("PracticeAttempts", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CorrectCount).HasColumnName("correct_count");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExpiredCount).HasColumnName("expired_count");

                entity.Property(e => e.IncorrectCount).HasColumnName("incorrect_count");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.PracticeId).HasColumnName("practice_id");

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UnattemptedCount).HasColumnName("unattempted_count");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.PracticeAttemptsCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeAttempts_CreatedByUser");

                entity.HasOne(d => d.Practice)
                    .WithMany(p => p.PracticeAttempts)
                    .HasForeignKey(d => d.PracticeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeAttempts_Practices");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.PracticeAttemptsUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeAttempts_UpdatedByUser");
            });

            modelBuilder.Entity<PracticeQuestions>(entity =>
            {
                entity.ToTable("PracticeQuestions", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.DurationSeconds).HasColumnName("duration_seconds");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.PracticeId).HasColumnName("practice_id");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.QuestionSequence).HasColumnName("question_sequence");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Practice)
                    .WithMany(p => p.PracticeQuestions)
                    .HasForeignKey(d => d.PracticeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeQuestions_Practice");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.PracticeQuestions)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PracticeQuestions_Question");
            });

            modelBuilder.Entity<Practices>(entity =>
            {
                entity.ToTable("Practices", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.ClassId).HasColumnName("class_id");

                entity.Property(e => e.Complexity).HasColumnName("complexity");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.CreditsNeeded)
                    .HasColumnName("credits_needed")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.Instruction).HasColumnName("instruction").HasColumnType("NVARCHAR(MAX)");


                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LanguageId).HasColumnName("language_id");

                entity.Property(e => e.Module)
                    .IsRequired()
                    .HasColumnName("module")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.ModuleId).HasColumnName("module_id");

                entity.Property(e => e.ModuleStatus)
                    .HasColumnName("module_status")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.OpenDatetime)
                    .HasColumnName("open_datetime")
                    .HasColumnType("datetime");

                entity.Property(e => e.Photo)
                    .HasColumnName("photo")
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.PracticesCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .HasConstraintName("FK_Practices_CreatedByUser");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.Practices)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Practices_Institutes");

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.Practices)
                    .HasForeignKey(d => d.LanguageId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Practices_Lang");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.PracticesUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .HasConstraintName("FK_Practices_UpdatedByUser");
            });

            modelBuilder.Entity<QuestionBugs>(entity =>
            {
                entity.ToTable("QuestionBugs", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BugDescription)
                    .HasColumnName("bug_description")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.BugId)
                    .HasColumnName("bug_id")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.BugTitle)
                    .IsRequired()
                    .HasColumnName("bug_title")
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsValid).HasColumnName("is_valid");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.Source)
                    .IsRequired()
                    .HasColumnName("source")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.TicketId)
                    .HasColumnName("ticket_id")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.QuestionBugsCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionBugs_CreatedByUser");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.QuestionBugs)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionBugs_Questions");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.QuestionBugsUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionBugs_UpdatedByUser");
            });

            modelBuilder.Entity<QuestionCategories>(entity =>
            {
                entity.ToTable("QuestionCategories", "dbo");

                entity.HasIndex(e => new { e.QuestionId, e.CategoryId, e.IsActive })
                    .HasName("UNIQUE_QuestionCategories")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CategoryId).HasColumnName("category_id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Category)
                    .WithMany(p => p.QuestionCategories)
                    .HasForeignKey(d => d.CategoryId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionCategories_Category");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.QuestionCategories)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionCategories_Question");
            });

            modelBuilder.Entity<QuestionLanguges>(entity =>
            {
                entity.ToTable("QuestionLanguges", "dbo");

                entity.HasIndex(e => new { e.QuestionId, e.LanguageId, e.IsActive })
                    .HasName("UNIQUE_Question")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AnswerExplanation).HasColumnName("answer_explanation");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description).HasColumnName("description");

                entity.Property(e => e.Direction)
                    .HasColumnName("direction")
                    .HasMaxLength(1500);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LanguageId).HasColumnName("language_id");

                entity.Property(e => e.Question)
                    .IsRequired()
                    .HasColumnName("question")
                    .HasMaxLength(2500);

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.QuestionLanguges)
                    .HasForeignKey(d => d.LanguageId)
                    .HasConstraintName("FK_QuestionLanguges_Languages");

                entity.HasOne(d => d.QuestionNavigation)
                    .WithMany(p => p.QuestionLanguges)
                    .HasForeignKey(d => d.QuestionId)
                    .HasConstraintName("FK_QuestionLanguges_Questions");
            });

            modelBuilder.Entity<QuestionOptionLanguages>(entity =>
            {
                entity.ToTable("QuestionOptionLanguages", "dbo");

                entity.HasIndex(e => new { e.QuestionOptionId, e.LanguageId, e.IsActive })
                    .HasName("UNIQUE_QuestionOption")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description)
                    .HasColumnName("description")
                    .HasMaxLength(1500);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LanguageId).HasColumnName("language_id");

                entity.Property(e => e.OptionText)
                    .IsRequired()
                    .HasColumnName("option_text")
                    .HasMaxLength(500);

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.QuestionOptionId).HasColumnName("question_option_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.QuestionOptionLanguages)
                    .HasForeignKey(d => d.LanguageId)
                    .HasConstraintName("FK_QuestionOptionLanguages_Languages");

                entity.HasOne(d => d.QuestionOption)
                    .WithMany(p => p.QuestionOptionLanguages)
                    .HasForeignKey(d => d.QuestionOptionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionOptionLanguages_QuestionOption");
            });

            modelBuilder.Entity<QuestionOptions>(entity =>
            {
                entity.ToTable("QuestionOptions", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsCorrect)
                    .HasColumnName("is_correct")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.OptionImage)
                    .HasColumnName("option_image")
                    .HasColumnType("image");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.QuestionOptions)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Options_Question");
            });

            modelBuilder.Entity<QuestionTags>(entity =>
            {
                entity.ToTable("QuestionTags", "dbo");

                entity.HasIndex(e => new { e.QuestionId, e.TagId, e.IsActive })
                    .HasName("UNIQUE_QuestionTags")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.QuestionId).HasColumnName("question_id");

                entity.Property(e => e.TagId).HasColumnName("tag_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Question)
                    .WithMany(p => p.QuestionTags)
                    .HasForeignKey(d => d.QuestionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionTags_Question");

                entity.HasOne(d => d.Tag)
                    .WithMany(p => p.QuestionTags)
                    .HasForeignKey(d => d.TagId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionTags_Tag");
            });

            modelBuilder.Entity<QuestionTypes>(entity =>
            {
                entity.ToTable("QuestionTypes", "dbo");

                entity.HasIndex(e => e.Code)
                    .HasName("UQ__Question__357D4CF96CC2ECD2")
                    .IsUnique();

                entity.HasIndex(e => e.Name)
                    .HasName("UQ__Question__72E12F1B0D7841EB")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Code)
                    .IsRequired()
                    .HasColumnName("code")
                    .HasMaxLength(10);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<Questions>(entity =>
            {
                entity.ToTable("Questions", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AuthorId).HasColumnName("author_id");

                entity.Property(e => e.ComplexityCode).HasColumnName("complexity_code");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Image)
                    .HasColumnName("image")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Source)
                    .HasColumnName("source")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.StatusCode)
                    .HasColumnName("status_code")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.TypeId)
                    .HasColumnName("type_id")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Author)
                    .WithMany(p => p.Questions)
                    .HasForeignKey(d => d.AuthorId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Questions_Author");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.Questions)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Questions_Institutes");

                entity.HasOne(d => d.Type)
                    .WithMany(p => p.Questions)
                    .HasForeignKey(d => d.TypeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Questions_Type");
            });

            modelBuilder.Entity<Roles>(entity =>
            {
                entity.ToTable("Roles", "dbo");

                entity.HasIndex(e => e.AccessLevel)
                    .HasName("UNIQUE_Roles_accessLevel")
                    .IsUnique();

                entity.HasIndex(e => new { e.Code, e.Name })
                    .HasName("UNIQUE_Roles_code_name")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AccessLevel).HasColumnName("access_level");

                entity.Property(e => e.Code)
                    .HasColumnName("code")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description)
                    .HasColumnName("description")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<States>(entity =>
            {
                entity.ToTable("States", "dbo");

                entity.HasIndex(e => new { e.Code, e.Name })
                    .HasName("UNIQUE_States_code_name")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Code)
                    .IsRequired()
                    .HasColumnName("code")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LanguageId).HasColumnName("language_id");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.States)
                    .HasForeignKey(d => d.LanguageId)
                    .HasConstraintName("FK_States_Langugage");
            });

            modelBuilder.Entity<Subjects>(entity =>
            {
                entity.ToTable("Subjects", "dbo");

                entity.HasIndex(e => new { e.ClassId, e.Name, e.IsActive })
                    .HasName("UNIQUE_Subjects_name")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.ClassId).HasColumnName("class_id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Cutoff).HasColumnName("cutoff");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(1500);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Class)
                    .WithMany(p => p.Subjects)
                    .HasForeignKey(d => d.ClassId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubjectClass");
            });

            modelBuilder.Entity<SubscribedExams>(entity =>
            {
                entity.ToTable("SubscribedExams", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExamId).HasColumnName("exam_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.SubscriptionId).HasColumnName("subscription_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.SubscribedExamsCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscripedExams_CreatedByUser");

                entity.HasOne(d => d.Exam)
                    .WithMany(p => p.SubscribedExams)
                    .HasForeignKey(d => d.ExamId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscripedExams_Exam");

                entity.HasOne(d => d.Subscription)
                    .WithMany(p => p.SubscribedExams)
                    .HasForeignKey(d => d.SubscriptionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscripedExams_Subscription");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.SubscribedExamsUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscripedExams_UpdatedByUser");
            });

            modelBuilder.Entity<SubscribedPractices>(entity =>
            {
                entity.ToTable("SubscribedPractices", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.PracticeId).HasColumnName("practice_id");

                entity.Property(e => e.SubscriptionId).HasColumnName("subscription_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.CreatedByNavigation)
                    .WithMany(p => p.SubscribedPracticesCreatedByNavigation)
                    .HasForeignKey(d => d.CreatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscribedPractices_CreatedByUser");

                entity.HasOne(d => d.Practice)
                    .WithMany(p => p.SubscribedPractices)
                    .HasForeignKey(d => d.PracticeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscribedPractices_Practice");

                entity.HasOne(d => d.Subscription)
                    .WithMany(p => p.SubscribedPractices)
                    .HasForeignKey(d => d.SubscriptionId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscribedPractices_Subscription");

                entity.HasOne(d => d.UpdatedByNavigation)
                    .WithMany(p => p.SubscribedPracticesUpdatedByNavigation)
                    .HasForeignKey(d => d.UpdatedBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscribedPractices_UpdatedByUser");
            });

            modelBuilder.Entity<Subscriptions>(entity =>
            {
                entity.ToTable("Subscriptions", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CancelledDate)
                    .HasColumnName("cancelled_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.EndDate)
                    .HasColumnName("end_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.IsCancelled)
                    .HasColumnName("is_cancelled")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.PgOrderId)
                    .IsRequired()
                    .HasColumnName("pg_order_id")
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.PgPaymentId)
                    .IsRequired()
                    .HasColumnName("pg_payment_id")
                    .HasMaxLength(256)
                    .IsUnicode(false);

                entity.Property(e => e.PgSignature)
                    .IsRequired()
                    .HasColumnName("pg_signature")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.PlanId).HasColumnName("plan_id");

                entity.Property(e => e.RemainingExamCredits).HasColumnName("remaining_exam_credits");

                entity.Property(e => e.RemainingPracticeCredits).HasColumnName("remaining_practice_credits");

                entity.Property(e => e.StartDate)
                    .HasColumnName("start_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.Status)
                    .IsRequired()
                    .HasColumnName("status")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.TotalExamCredits).HasColumnName("total_exam_credits");

                entity.Property(e => e.TotalPracticeCredits).HasColumnName("total_practice_credits");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.Plan)
                    .WithMany(p => p.Subscriptions)
                    .HasForeignKey(d => d.PlanId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubscriptionPlan");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.Subscriptions)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK__Subscript__user___54264DA3");
            });

            modelBuilder.Entity<Tags>(entity =>
            {
                entity.ToTable("Tags", "dbo");

                entity.HasIndex(e => e.Name)
                    .HasName("UQ__Tags__72E12F1B6AB4D48B")
                    .IsUnique();

                entity.HasIndex(e => new { e.InstituteId, e.Name, e.IsActive })
                    .HasName("UNIQUE_Tags_name")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .IsRequired()
                    .HasColumnName("name")
                    .HasMaxLength(500);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<UserGroupExams>(entity =>
            {
                entity.ToTable("UserGroupExams", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.ExamId).HasColumnName("exam_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserGroupId).HasColumnName("user_group_id");

                entity.HasOne(d => d.Exam)
                    .WithMany(p => p.UserGroupExams)
                    .HasForeignKey(d => d.ExamId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroupExams_Exams");

                entity.HasOne(d => d.UserGroup)
                    .WithMany(p => p.UserGroupExams)
                    .HasForeignKey(d => d.UserGroupId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroupExams_UserGroup");
            });

            modelBuilder.Entity<UserGroupMembers>(entity =>
            {
                entity.ToTable("UserGroupMembers", "dbo");

                entity.HasIndex(e => new { e.UserGroupId, e.UserId, e.IsActive })
                    .HasName("UNIQUE_UserGroupsMember")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserGroupId).HasColumnName("user_group_id");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.UserGroup)
                    .WithMany(p => p.UserGroupMembers)
                    .HasForeignKey(d => d.UserGroupId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroupMembers_UserGroup");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.UserGroupMembers)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroupMembers_User");
            });

            modelBuilder.Entity<UserGroupPractices>(entity =>
            {
                entity.ToTable("UserGroupPractices", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.PracticeId).HasColumnName("practice_id");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserGroupId).HasColumnName("user_group_id");

                entity.HasOne(d => d.Practice)
                    .WithMany(p => p.UserGroupPractices)
                    .HasForeignKey(d => d.PracticeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroupPractices_Practices");

                entity.HasOne(d => d.UserGroup)
                    .WithMany(p => p.UserGroupPractices)
                    .HasForeignKey(d => d.UserGroupId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroupPractices_UserGroup");
            });

            modelBuilder.Entity<UserGroups>(entity =>
            {
                entity.ToTable("UserGroups", "dbo");

                entity.HasIndex(e => new { e.ClassId, e.Name, e.IsActive })
                    .HasName("UNIQUE_UserGroups")
                    .IsUnique()
                    .HasFilter("([is_active]=(1))");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.ClassId).HasColumnName("class_id");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Description)
                    .HasColumnName("description")
                    .IsUnicode(false);

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.Name)
                    .HasColumnName("name")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.Photo)
                    .HasColumnName("photo")
                    .HasColumnType("image");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.HasOne(d => d.Class)
                    .WithMany(p => p.UserGroups)
                    .HasForeignKey(d => d.ClassId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserGroups_Class");
            });

            modelBuilder.Entity<UserLogs>(entity =>
            {
                entity.ToTable("UserLogs", "dbo");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.ActionDate)
                    .HasColumnName("action_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LoggedOnAt)
                    .HasColumnName("logged_on_at")
                    .HasColumnType("datetime");

                entity.Property(e => e.LoggedOnFromIpAddr)
                    .HasColumnName("logged_on_from_ip_addr")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.LoggedOnFromLatitude)
                    .HasColumnName("logged_on_from_latitude")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.LoggedOnFromLongitude)
                    .HasColumnName("logged_on_from_longitude")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.LoggedOutAt)
                    .HasColumnName("logged_out_at")
                    .HasColumnType("datetime");

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnName("user_id");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.UserLogs)
                    .HasForeignKey(d => d.UserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_UserLogs_User");
            });

            modelBuilder.Entity<Users>(entity =>
            {
                entity.ToTable("Users", "dbo");

                entity.HasIndex(e => new { e.InstituteId, e.EmailId })
                    .HasName("UNIQUE_Users_Institute_Email")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AccessToken)
                    .HasColumnName("access_token")
                    .HasMaxLength(100);

                entity.Property(e => e.Address)
                    .HasColumnName("address")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.BatchId).HasColumnName("batch_id");

                entity.Property(e => e.City)
                    .HasColumnName("city")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.Country)
                    .HasColumnName("country")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.Property(e => e.CreatedBy).HasColumnName("created_by");

                entity.Property(e => e.CreatedOn)
                    .HasColumnName("created_on")
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.DateOfBirth)
                    .HasColumnName("date_of_birth")
                    .HasColumnType("date");

                entity.Property(e => e.EmailId)
                    .HasColumnName("email_id")
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.FirstName)
                    .HasColumnName("first_name")
                    .HasMaxLength(50);

                entity.Property(e => e.Gender)
                    .HasColumnName("gender")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.InstituteId).HasColumnName("institute_id");

                entity.Property(e => e.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

                entity.Property(e => e.LanguageId).HasColumnName("language_id");

                entity.Property(e => e.LastName)
                    .HasColumnName("last_name")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Latitude)
                    .HasColumnName("latitude")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.Longitude)
                    .HasColumnName("longitude")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.MobileNo)
                    .HasColumnName("mobile_no")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.Photo)
                    .HasColumnName("photo")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.PinCode)
                    .HasColumnName("pin_code")
                    .HasMaxLength(6)
                    .IsUnicode(false);

                entity.Property(e => e.RegistrationDatetime)
                    .HasColumnName("registration_datetime")
                    .HasColumnType("datetime");

                entity.Property(e => e.RegistrationId).HasColumnName("registration_id");

                entity.Property(e => e.RoleId).HasColumnName("role_id");

                entity.Property(e => e.StateCode)
                    .HasColumnName("state_code")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdatedBy).HasColumnName("updated_by");

                entity.Property(e => e.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");

                entity.Property(e => e.UserPassword)
                    .HasColumnName("user_password")
                    .HasMaxLength(500);

                entity.Property(e => e.UserSalt)
                    .HasColumnName("user_salt")
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.Uuid)
                    .HasColumnName("uuid")
                    .HasMaxLength(512);

                entity.HasOne(d => d.Batch)
                    .WithMany(p => p.Users)
                    .HasForeignKey(d => d.BatchId)
                    .HasConstraintName("FK_Users_UserGroups");

                entity.HasOne(d => d.Institute)
                    .WithMany(p => p.Users)
                    .HasForeignKey(d => d.InstituteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_User_Institute");

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.Users)
                    .HasForeignKey(d => d.LanguageId)
                    .HasConstraintName("FK_User_Language");

                entity.HasOne(d => d.Role)
                    .WithMany(p => p.Users)
                    .HasForeignKey(d => d.RoleId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_User_Role");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
