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<BookmarkedNotes> BookmarkedNotes { 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<CategoryLanguages> CategoryLanguages { get; set; }
        public virtual DbSet<ClassExams> ClassExams { get; set; }
        public virtual DbSet<ClassLanguages> ClassLanguages { 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<ExamLanguages> ExamLanguages { get; set; }
        public virtual DbSet<ExamPracticeAttempts> ExamPracticeAttempts { get; set; }
        public virtual DbSet<ExamPracticeLanguages> ExamPracticeLanguages { get; set; }
        public virtual DbSet<ExamPracticeTypes> ExamPracticeTypes { get; set; }
        public virtual DbSet<ExamPractices> ExamPractices { get; set; }
        public virtual DbSet<ExamQuestionsInPractice> ExamQuestionsInPractice { 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<LibraryContents> LibraryContents { get; set; }
        public virtual DbSet<LibraryContentsLanguages> LibraryContentsLanguages { get; set; }
        public virtual DbSet<LibraryContentsSubCategories> LibraryContentsSubCategories { get; set; }
        public virtual DbSet<LibraryContentsTags> LibraryContentsTags { get; set; }
        public virtual DbSet<ModuleRoles> ModuleRoles { get; set; }
        public virtual DbSet<Modules> Modules { get; set; }
        public virtual DbSet<PasswordReset> PasswordReset { get; set; }
        public virtual DbSet<Plans> Plans { 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<QuestionSubCategories> QuestionSubCategories { 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<StudentAnswers> StudentAnswers { get; set; }
        public virtual DbSet<StudyNotes> StudyNotes { get; set; }
        public virtual DbSet<StudyNotesTags> StudyNotesTags { get; set; }
        public virtual DbSet<SubCategories> SubCategories { get; set; }
        public virtual DbSet<SubCategoryLanguages> SubCategoryLanguages { get; set; }
        public virtual DbSet<SubjectLanguages> SubjectLanguages { get; set; }
        public virtual DbSet<Subjects> Subjects { get; set; }
        public virtual DbSet<Subscriptions> Subscriptions { get; set; }
        public virtual DbSet<TagLanguages> TagLanguages { get; set; }
        public virtual DbSet<Tags> Tags { get; set; }
        public virtual DbSet<UserGroupMembers> UserGroupMembers { 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 OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ActivityLogs>(entity =>
            {
                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.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.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.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BookmarkDate)
                    .HasColumnName("bookmark_date")
                    .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.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<BookmarkedNotes>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

                entity.Property(e => e.StudyNoteId).HasColumnName("study_note_id");

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

                entity.HasOne(d => d.StudyNote)
                    .WithMany(p => p.BookmarkedNotes)
                    .HasForeignKey(d => d.StudyNoteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_BookmarkedNotes_StudyNote");

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

            modelBuilder.Entity<BookmarkedPractices>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BookmarkDate)
                    .HasColumnName("bookmark_date")
                    .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.UserId).HasColumnName("user_id");

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

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

            modelBuilder.Entity<BookmarkedQuestions>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.BookmarkDate)
                    .HasColumnName("bookmark_date")
                    .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.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.Property(e => e.Id).HasColumnName("id");

                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.Photo)
                    .HasColumnName("photo")
                    .HasColumnType("image");

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

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

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

            modelBuilder.Entity<CategoryLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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")
                    .HasDefaultValueSql("((1))");

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

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

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.CategoryLanguages)
                    .HasForeignKey(d => d.LanguageId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_CategoryLanguages_Languages");
            });

            modelBuilder.Entity<ClassExams>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

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

                entity.HasOne(d => d.Class)
                    .WithMany(p => p.ClassExams)
                    .HasForeignKey(d => d.ClassId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ClassExams_Class");

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

            modelBuilder.Entity<ClassLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

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

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

                entity.HasOne(d => d.Class)
                    .WithMany(p => p.ClassLanguages)
                    .HasForeignKey(d => d.ClassId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ClassLanguages_Class");

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.ClassLanguages)
                    .HasForeignKey(d => d.LanguageId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ClassLanguages_Languages");
            });

            modelBuilder.Entity<Classes>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.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.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.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");
            });

            modelBuilder.Entity<ErrorLogs>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.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.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AssessmentStatus)
                    .HasColumnName("assessment_status")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.AttemptedSequence).HasColumnName("attempted_sequence");

                entity.Property(e => e.AverageTimeTaken).HasColumnName("average_time_taken");

                entity.Property(e => e.CompletedOn)
                    .HasColumnName("completed_on")
                    .HasColumnType("datetime");

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

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

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

                entity.Property(e => e.StartedOn)
                    .HasColumnName("started_on")
                    .HasColumnType("datetime");

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

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

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

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

            modelBuilder.Entity<ExamAttemptsAnswer>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Comments)
                    .HasColumnName("comments")
                    .IsUnicode(false);

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

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

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

                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.UserId).HasColumnName("user_id");

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

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

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

            modelBuilder.Entity<ExamAttemptsAssessment>(entity =>
            {
                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.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.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<ExamLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

                entity.Property(e => e.Instruction)
                    .HasColumnName("instruction")
                    .HasMaxLength(1500);

                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.HasOne(d => d.Exam)
                    .WithMany(p => p.ExamLanguages)
                    .HasForeignKey(d => d.ExamId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamLanguages_Exams");

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

            modelBuilder.Entity<ExamPracticeAttempts>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AttemptedSequence).HasColumnName("attempted_sequence");

                entity.Property(e => e.AverageTimeTaken).HasColumnName("average_time_taken");

                entity.Property(e => e.CompletedOn)
                    .HasColumnName("completed_on")
                    .HasColumnType("datetime");

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

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

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

                entity.Property(e => e.StartedOn)
                    .HasColumnName("started_on")
                    .HasColumnType("datetime");

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

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

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

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

            modelBuilder.Entity<ExamPracticeLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.ExamPracticeId).HasColumnName("exam_practice_id");

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

                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.HasOne(d => d.ExamPractice)
                    .WithMany(p => p.ExamPracticeLanguages)
                    .HasForeignKey(d => d.ExamPracticeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamPracticeLanguages_ExamPractice");

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

            modelBuilder.Entity<ExamPracticeTypes>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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(100)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ExamPractices>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.CreatedByUserId).HasColumnName("created_by_user_id");

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

                entity.Property(e => e.ExamPracticeTypeId).HasColumnName("exam_practice_type_id");

                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.Photo)
                    .HasColumnName("photo")
                    .HasColumnType("image");

                entity.Property(e => e.QuestionDurationInMinutes).HasColumnName("question_duration_in_minutes");

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

                entity.Property(e => e.TotalDurationInMinutes).HasColumnName("total_duration_in_minutes");

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

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

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

                entity.HasOne(d => d.CreatedByUser)
                    .WithMany(p => p.ExamPractices)
                    .HasForeignKey(d => d.CreatedByUserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamPractices_CreatedByUser");

                entity.HasOne(d => d.ExamPracticeType)
                    .WithMany(p => p.ExamPractices)
                    .HasForeignKey(d => d.ExamPracticeTypeId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_ExamPractices_Type");

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

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

            modelBuilder.Entity<ExamQuestionsInPractice>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.Mark).HasColumnName("mark");

                entity.Property(e => e.NegativeMark).HasColumnName("negative_mark");

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

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

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

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

            modelBuilder.Entity<ExamQuestionsMarkWeight>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.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.Property(e => e.Id).HasColumnName("id");

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

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

                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.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.Property(e => e.Id).HasColumnName("id");

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

                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);
            });

            modelBuilder.Entity<Exams>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.Complexity)
                    .HasColumnName("complexity")
                    .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.ExamCloseDatetime)
                    .HasColumnName("exam_close_datetime")
                    .HasColumnType("datetime");

                entity.Property(e => e.ExamDurationInMinutes).HasColumnName("exam_duration_in_minutes");

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

                entity.Property(e => e.ExamStatus)
                    .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.IsActive)
                    .HasColumnName("is_active")
                    .HasDefaultValueSql("((1))");

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

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

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

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

                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.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.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")
                    .HasColumnType("image");

                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.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.Property(e => e.Id).HasColumnName("id");

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

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

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

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

            modelBuilder.Entity<LibraryContents>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

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

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

            modelBuilder.Entity<LibraryContentsLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

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

                entity.Property(e => e.LibraryContentId).HasColumnName("library_content_id");

                entity.Property(e => e.Link)
                    .HasColumnName("link")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

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

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

                entity.HasOne(d => d.LibraryContent)
                    .WithMany(p => p.LibraryContentsLanguages)
                    .HasForeignKey(d => d.LibraryContentId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_LibraryContentsLanguages_LibraryContents");
            });

            modelBuilder.Entity<LibraryContentsSubCategories>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.LibraryContentId).HasColumnName("library_content_id");

                entity.Property(e => e.SubCategoryId).HasColumnName("sub_category_id");

                entity.HasOne(d => d.LibraryContent)
                    .WithMany(p => p.LibraryContentsSubCategories)
                    .HasForeignKey(d => d.LibraryContentId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_LibraryContentsSubCategories_LibraryContents");

                entity.HasOne(d => d.SubCategory)
                    .WithMany(p => p.LibraryContentsSubCategories)
                    .HasForeignKey(d => d.SubCategoryId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_LibraryContentsSubCategories_SubCategory");
            });

            modelBuilder.Entity<LibraryContentsTags>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.LibraryContentId).HasColumnName("library_content_id");

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

                entity.HasOne(d => d.LibraryContent)
                    .WithMany(p => p.LibraryContentsTags)
                    .HasForeignKey(d => d.LibraryContentId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_LibraryContentsTags_LibraryContents");

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

            modelBuilder.Entity<ModuleRoles>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.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.Property(e => e.Id).HasColumnName("id");

                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.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<PasswordReset>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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.HasOne(d => d.GeneratedForUser)
                    .WithMany(p => p.PasswordReset)
                    .HasForeignKey(d => d.GeneratedForUserId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_PasswordReset_User");
            });

            modelBuilder.Entity<Plans>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.UpdatedOn)
                    .HasColumnName("updated_on")
                    .HasColumnType("datetime");
            });

            modelBuilder.Entity<QuestionLanguges>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

                entity.Property(e => e.Hint)
                    .HasColumnName("hint")
                    .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.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.Property(e => e.Id).HasColumnName("id");

                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.QuestionOptionId).HasColumnName("question_option_id");

                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.Property(e => e.Id).HasColumnName("id");

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

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

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

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

            modelBuilder.Entity<QuestionSubCategories>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

                entity.Property(e => e.SubCategoryId).HasColumnName("sub_category_id");

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

                entity.HasOne(d => d.SubCategory)
                    .WithMany(p => p.QuestionSubCategories)
                    .HasForeignKey(d => d.SubCategoryId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionSubCategories_SubCategory");
            });

            modelBuilder.Entity<QuestionTags>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.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.Property(e => e.Id).HasColumnName("id");

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

                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")
                    .HasDefaultValueSql("((1))");

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

                entity.HasOne(d => d.Language)
                    .WithMany(p => p.QuestionTypes)
                    .HasForeignKey(d => d.LanguageId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_QuestionTypes_Languages");
            });

            modelBuilder.Entity<Questions>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AnswerOptionId).HasColumnName("answer_option_id");

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

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

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

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

                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.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.HasIndex(e => e.AccessLevel)
                    .HasName("UNIQUE_Roles_accessLevel")
                    .IsUnique();

                entity.HasIndex(e => e.Code)
                    .HasName("UNIQUE_Roles_code")
                    .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.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);
            });

            modelBuilder.Entity<States>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

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

                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.HasOne(d => d.Language)
                    .WithMany(p => p.States)
                    .HasForeignKey(d => d.LanguageId)
                    .HasConstraintName("FK_States_Langugage");
            });

            modelBuilder.Entity<StudentAnswers>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.AnswerDate)
                    .HasColumnName("answer_date")
                    .HasColumnType("datetime");

                entity.Property(e => e.Comments)
                    .HasColumnName("comments")
                    .IsUnicode(false);

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

                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.Score).HasColumnName("score");

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

                entity.Property(e => e.StudentDoubt)
                    .HasColumnName("student_doubt")
                    .IsUnicode(false);

                entity.Property(e => e.TimeTaken).HasColumnName("time_taken");

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

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

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

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

            modelBuilder.Entity<StudyNotes>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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.PdfUrl)
                    .HasColumnName("pdf_url")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

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

                entity.Property(e => e.SubCategoryId).HasColumnName("sub_category_id");

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

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

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

                entity.Property(e => e.VideoUrl)
                    .HasColumnName("video_url")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.HasOne(d => d.Category)
                    .WithMany(p => p.StudyNotes)
                    .HasForeignKey(d => d.CategoryId)
                    .HasConstraintName("FK_StudyNotes_Category");

                entity.HasOne(d => d.SubCategory)
                    .WithMany(p => p.StudyNotes)
                    .HasForeignKey(d => d.SubCategoryId)
                    .HasConstraintName("FK_StudyNotes_SubCategory");

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

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

            modelBuilder.Entity<StudyNotesTags>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                entity.Property(e => e.StudyNoteId).HasColumnName("study_note_id");

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

                entity.HasOne(d => d.StudyNote)
                    .WithMany(p => p.StudyNotesTags)
                    .HasForeignKey(d => d.StudyNoteId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_StudyNotesTags_StudyNote");

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

            modelBuilder.Entity<SubCategories>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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.Photo)
                    .HasColumnName("photo")
                    .HasColumnType("image");

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

                entity.HasOne(d => d.Category)
                    .WithMany(p => p.SubCategories)
                    .HasForeignKey(d => d.CategoryId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubCategories_Category");
            });

            modelBuilder.Entity<SubCategoryLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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")
                    .HasDefaultValueSql("((1))");

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

                entity.Property(e => e.SubcategoryId).HasColumnName("subcategory_id");

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

                entity.HasOne(d => d.Subcategory)
                    .WithMany(p => p.SubCategoryLanguages)
                    .HasForeignKey(d => d.SubcategoryId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_SubCategoryLanguages_SubCategory");
            });

            modelBuilder.Entity<SubjectLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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")
                    .HasDefaultValueSql("((1))");

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

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

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

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

            modelBuilder.Entity<Subjects>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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.Photo)
                    .HasColumnName("photo")
                    .HasColumnType("image");

                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<Subscriptions>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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.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.PlanId).HasColumnName("plan_id");

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

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

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

            modelBuilder.Entity<TagLanguages>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

                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")
                    .HasDefaultValueSql("((1))");

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

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

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

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

            modelBuilder.Entity<Tags>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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.PdfUrl)
                    .HasColumnName("pdf_url")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

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

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

                entity.Property(e => e.VideoUrl)
                    .HasColumnName("video_url")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

                entity.HasOne(d => d.Category)
                    .WithMany(p => p.Tags)
                    .HasForeignKey(d => d.CategoryId)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_Tags_Category");
            });

            modelBuilder.Entity<UserGroupMembers>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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<UserGroups>(entity =>
            {
                entity.Property(e => e.Id).HasColumnName("id");

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

                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.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.Property(e => e.Id).HasColumnName("id");

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

                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.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.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.City)
                    .HasColumnName("city")
                    .HasMaxLength(1500)
                    .IsUnicode(false);

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

                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)
                    .IsRequired()
                    .HasColumnName("first_name")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                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")
                    .HasColumnType("image");

                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.StateId).HasColumnName("state_id");

                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.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");

                entity.HasOne(d => d.State)
                    .WithMany(p => p.Users)
                    .HasForeignKey(d => d.StateId)
                    .HasConstraintName("FK_User_State");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
