using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Models.Disables;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
using Microsoft.EntityFrameworkCore;

namespace BMA.EHR.Recurit.Exam.Service.Data
{
    public class ApplicationDbContext : DbContext
    {
        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
            : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            // disable relation setup
            modelBuilder.Entity<PeriodExam>().HasMany(x => x.Disables).WithOne(x => x.PeriodExam).OnDelete(DeleteBehavior.Cascade);
            modelBuilder.Entity<Disable>().HasMany(x => x.Educations).WithOne(x => x.Disable).OnDelete(DeleteBehavior.Cascade);
            modelBuilder.Entity<Disable>().HasMany(x => x.Occupations).WithOne(x => x.Disable).OnDelete(DeleteBehavior.Cascade);
            modelBuilder.Entity<Disable>().HasMany(x => x.Addresses).WithOne(x => x.Disable).OnDelete(DeleteBehavior.Cascade);
            modelBuilder.Entity<Disable>().HasMany(x => x.Certificates).WithOne(x => x.Disable).OnDelete(DeleteBehavior.Cascade);
            modelBuilder.Entity<Disable>().HasMany(x => x.Payments).WithOne(x => x.Disable).OnDelete(DeleteBehavior.Cascade);
        }

        // public DbSet<Prefix> Prefixes { get; set; }

        // public DbSet<Religion> Religions { get; set; }

        // public DbSet<Relationship> Relationships { get; set; }

        // public DbSet<EducationLevel> EducationLevels { get; set; }

        // public DbSet<Province> Provinces { get; set; }

        // public DbSet<District> Districts { get; set; }

        // public DbSet<SubDistrict> SubDistricts { get; set; }

        public DbSet<PeriodExam> PeriodExams { get; set; }

        public DbSet<Candidate> Candidates { get; set; }

        public DbSet<Career> Careers { get; set; }

        public DbSet<Education> Educations { get; set; }

        public DbSet<Document> Documents { get; set; }

        public DbSet<CandidateDocument> CandidateDocuments { get; set; }

        public DbSet<PositionExam> PositionExams { get; set; }

        public DbSet<BankExam> BankExams { get; set; }

        public DbSet<PeriodExamDocument> PeriodExamDocuments { get; set; }

        public DbSet<PeriodExamImage> PeriodExamImages { get; set; }
        public DbSet<PeriodExamBarCode> PeriodExamBarCodes { get; set; }
        public DbSet<PeriodExamQrCode> PeriodExamQrCodes { get; set; }

        public DbSet<CMSCandidate> CMSCandidates { get; set; }

        public DbSet<CMSAgency> CMSAgencys { get; set; }

        public DbSet<CMSGovernment> CMSGovernments { get; set; }

        public DbSet<Disable> Disables { get; set; }

        public DbSet<DisableAddress> DisableAddresses { get; set; }

        public DbSet<DisableOccupation> DisableOccupations { get; set; }

        public DbSet<DisableCertificate> DisableCertificates { get; set; }

        public DbSet<DisableEducation> DisableEducations { get; set; }

        public DbSet<ScoreImport> ScoreImports { get; set; }

        public DbSet<DisableScore> DisableScores { get; set; }

        public DbSet<DisablePayment> DisablePayments { get; set; }

        public DbSet<DisableDocument> DisableDocuments { get; set; }

        public DbSet<DisableImportHistory> DisableImportHistories { get; set; }

    }
}
