using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Documents;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.OrganizationEmployee;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Organizations.Report2;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Models.Probation;
using BMA.EHR.Domain.Models.Retirement;
using Microsoft.EntityFrameworkCore;

namespace BMA.EHR.Infrastructure.Persistence
{
    public class ApplicationDBContext : DbContext, IApplicationDBContext
    {
        #region " From Existing Database "

        #region " Meta Data "

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

        public DbSet<BloodGroup> BloodGroups { get; set; }

        public DbSet<Gender> Genders { get; set; }

        public DbSet<PhysicalStatus> PhysicalStatuses { get; set; }

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

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

        public DbSet<PositionPath> PositionPaths { get; set; }

        public DbSet<PositionType> PositionTypes { get; set; }

        public DbSet<PositionEmployeePosition> PositionEmployeePositions { get; set; }

        public DbSet<PositionEmployeePositionSide> PositionEmployeePositionSides { get; set; }

        public DbSet<PositionEmployeeGroup> PositionEmployeeGroups { get; set; }

        public DbSet<PositionEmployeeLine> PositionEmployeeLines { get; set; }

        public DbSet<PositionEmployeeLevel> PositionEmployeeLevels { get; set; }

        public DbSet<PositionEmployeeStatus> PositionEmployeeStatuses { get; set; }

        public DbSet<PositionLine> PositionLines { get; set; }

        public DbSet<PositionExecutive> PositionExecutives { get; set; }

        public DbSet<PositionStatus> PositionStatuss { get; set; }

        public DbSet<PositionLevel> PositionLevels { get; set; }

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

        public DbSet<Position> Positions { get; set; }

        public DbSet<PositionPathSide> PositionPathSides { get; set; }

        public DbSet<PositionExecutiveSide> PositionExecutiveSides { get; set; }

        public DbSet<InsigniaType> InsigniaTypes { get; set; }

        public DbSet<Insignia> Insignias { get; set; }

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

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

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

        public DbSet<Holiday> Holidays { get; set; }

        public DbSet<OrganizationType> OrganizationTypes { get; set; }

        public DbSet<OrganizationLevel> OrganizationLevels { get; set; }

        public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }

        public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }

        public DbSet<OrganizationStatus> OrganizationStatuses { get; set; }

        public DbSet<OrganizationAgency> OrganizationAgencys { get; set; }

        public DbSet<OrganizationGovernmentAgency> OrganizationGovernmentAgencys { get; set; }

        public DbSet<OrganizationTelExternal> OrganizationTelExternals { get; set; }

        public DbSet<OrganizationTelInternal> OrganizationTelInternals { get; set; }

        public DbSet<OrganizationFax> OrganizationFaxs { get; set; }

        public DbSet<RoyalHierarchy> RoyalHierarchys { get; set; }

        public DbSet<RoyalType> RoyalTypes { get; set; }

        public DbSet<Royal> Royals { get; set; }

        #endregion

        #region " Documents "

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

        #endregion

        #region " Organizations "

        public DbSet<AvailablePositionLevelEntity> AvailablePositionLevels { get; set; }

        public DbSet<PositionMasterEntity> PositionMasters { get; set; }

        public DbSet<OrganizationEntity> Organizations { get; set; }

        public DbSet<PositionNumberEntity> PositionNumbers { get; set; }

        public DbSet<OrganizationPositionEntity> OrganizationPositions { get; set; }

        public DbSet<ProfilePosition> ProfilePositions { get; set; }

        public DbSet<Report2> Report2s { get; set; }

        public DbSet<Report2History> Report2Histories { get; set; }

        public DbSet<Report2DetailHistory> Report2DetailHistories { get; set; }

        public DbSet<OrganizationPublishHistoryEntity> OrganizationPublishHistories { get; set; }

        #endregion

        #region " HR "

        public DbSet<Profile> Profiles { get; set; }

        public DbSet<ProfileEducation> ProfileEducations { get; set; }

        public DbSet<ProfileEducationHistory> ProfileEducationHistorys { get; set; }

        public DbSet<ProfileHonor> ProfileHonors { get; set; }

        public DbSet<ProfileHonorHistory> ProfileHonorHistorys { get; set; }

        public DbSet<ProfileAssessment> ProfileAssessments { get; set; }

        public DbSet<ProfileAssessmentHistory> ProfileAssessmentHistorys { get; set; }

        public DbSet<ProfileDiscipline> ProfileDisciplines { get; set; }

        public DbSet<ProfileDisciplineHistory> ProfileDisciplineHistorys { get; set; }

        public DbSet<ProfileCertificate> ProfileCertificates { get; set; }

        public DbSet<ProfileCertificateHistory> ProfileCertificateHistorys { get; set; }

        public DbSet<ProfileTraining> ProfileTrainings { get; set; }

        public DbSet<ProfileTrainingHistory> ProfileTrainingHistorys { get; set; }

        public DbSet<ProfileInsignia> ProfileInsignias { get; set; }

        public DbSet<ProfileInsigniaHistory> ProfileInsigniaHistorys { get; set; }

        public DbSet<ProfileSalary> ProfileSalaries { get; set; }

        public DbSet<ProfileSalaryHistory> ProfileSalaryHistories { get; set; }

        public DbSet<ProfileSalaryOrganization> ProfileSalaryOrganizations { get; set; }

        public DbSet<ProfileSalaryPosition> ProfileSalaryPositions { get; set; }

        public DbSet<ProfileSalaryPositionNumber> ProfileSalaryPositionsNumbers { get; set; }

        public DbSet<ProfileHistory> ProfileHistory { get; set; }

        public DbSet<ProfileCoupleHistory> ProfileCoupleHistory { get; set; }

        public DbSet<ProfileFatherHistory> ProfileFatherHistory { get; set; }

        public DbSet<ProfileMotherHistory> ProfileMotherHistory { get; set; }

        public DbSet<ProfileFamilyHistory> ProfileFamilyHistory { get; set; }

        public DbSet<ProfileGovernmentHistory> ProfileGovernmentHistory { get; set; }

        public DbSet<ProfileLeave> ProfileLeaves { get; set; }

        public DbSet<ProfileLeaveHistory> ProfileLeaveHistorys { get; set; }

        public DbSet<ProfileSalaryPositionLevel> ProfileSalaryPositionLevels { get; set; }

        public DbSet<ProfileSalaryPositionType> ProfileSalaryPositionTypes { get; set; }

        public DbSet<ProfileChildren> ProfileChildrens { get; set; }

        public DbSet<ProfileChildrenHistory> ProfileChildrenHistories { get; set; }

        public DbSet<ProfilePaper> ProfilePapers { get; set; }

        public DbSet<ProfileCurrentAddressHistory> ProfileCurrentAddressHistories { get; set; }

        public DbSet<ProfileRegistrationAddressHistory> ProfileRegistrationAddressHistories { get; set; }

        public DbSet<ProfileAddressHistory> ProfileAddressHistories { get; set; }

        public DbSet<ProfileOther> ProfileOthers { get; set; }

        public DbSet<ProfileOtherHistory> ProfileOtherHistorys { get; set; }

        public DbSet<ProfileAbility> ProfileAbilitys { get; set; }

        public DbSet<ProfileAbilityHistory> ProfileAbilityHistorys { get; set; }

        public DbSet<ProfileDuty> ProfileDutys { get; set; }

        public DbSet<ProfileDutyHistory> ProfileDutyHistorys { get; set; }

        public DbSet<ProfileNopaid> ProfileNopaids { get; set; }

        public DbSet<ProfileNopaidHistory> ProfileNopaidHistorys { get; set; }

        public DbSet<ProfileAvatarHistory> ProfileAvatarHistories { get; set; }

        public DbSet<ProfileOrganization> ProfileOrganizations { get; set; }

        public DbSet<ProfileChangeName> ProfileChangeNames { get; set; }

        public DbSet<ProfileChangeNameHistory> ProfileChangeNameHistorys { get; set; }

        public DbSet<TypeLeave> TypeLeaves { get; set; }

        public DbSet<LimitLeave> LimitLeaves { get; set; }

        public DbSet<LimitTypeLeave> LimitTypeLeaves { get; set; }

        #endregion

        #endregion

        #region " Placements "

        public DbSet<Placement> Placements { get; set; }
        public DbSet<PlacementCertificate> PlacementCertificates { get; set; }
        public DbSet<PlacementEducation> PlacementEducations { get; set; }
        public DbSet<PlacementIsProperty> PlacementIsProperties { get; set; }
        public DbSet<PlacementProfile> PlacementProfiles { get; set; }
        public DbSet<PlacementType> PlacementTypes { get; set; }
        public DbSet<PlacementTransfer> PlacementTransfers { get; set; }
        public DbSet<PlacementReceive> PlacementReceives { get; set; }
        public DbSet<PlacementRelocation> PlacementRelocations { get; set; }
        public DbSet<PlacementAppointment> PlacementAppointments { get; set; }
        public DbSet<PlacementTransferDoc> PlacementTransferDocs { get; set; }
        public DbSet<PlacementReceiveDoc> PlacementReceiveDocs { get; set; }
        public DbSet<PlacementRelocationDoc> PlacementRelocationDocs { get; set; }
        public DbSet<PlacementAppointmentDoc> PlacementAppointmentDocs { get; set; }
        public DbSet<PlacementOfficer> PlacementOfficers { get; set; }
        public DbSet<PlacementRepatriation> PlacementRepatriations { get; set; }

        #endregion

        #region " OrganizationEmployee "

        public DbSet<OrgEmployee> OrganizationEmployees { get; set; }
        public DbSet<OrganizationEmployeeProfile> OrganizationEmployeeProfiles { get; set; }
        public DbSet<OrganizationPositionEmployeeLevel> OrganizationPositionEmployeeLevels { get; set; }
        public DbSet<OrganizationPositionEmployeePositionSide> OrganizationPositionEmployeePositionSides { get; set; }

        #endregion

        #region " Command "

        public DbSet<CommandStatus> CommandStatuses { get; set; }

        public DbSet<CommandType> CommandTypes { get; set; }

        public DbSet<CommandDocument> CommandDocuments { get; set; }

        public DbSet<DeploymentChannel> DeploymentChannels { get; set; }

        public DbSet<Command> Commands { get; set; }

        public DbSet<CommandDeployment> CommandDeployments { get; set; }

        public DbSet<CommandReceiver> CommandReceivers { get; set; }

        #endregion

        #region " Message Queue "

        public DbSet<MessageQueueEntity> MessageQueues { get; set; }

        public DbSet<Inbox> Inboxes { get; set; }

        public DbSet<Notification> Notifications { get; set; }

        #endregion

        #region " Insignia "

        public DbSet<InsigniaPeriod> InsigniaPeriods { get; set; }
        public DbSet<InsigniaRequest> InsigniaRequests { get; set; }
        public DbSet<InsigniaRequestProfile> InsigniaRequestProfiles { get; set; }
        public DbSet<InsigniaManage> InsigniaManages { get; set; }
        public DbSet<InsigniaNoteProfile> InsigniaNoteProfiles { get; set; }
        public DbSet<InsigniaNote> InsigniaNotes { get; set; }
        public DbSet<InsigniaNoteDoc> InsigniaNoteDocs { get; set; }
        public DbSet<InsigniaManageOrganiation> InsigniaManageOrganiations { get; set; }
        public DbSet<InsigniaManageProfile> InsigniaManageProfiles { get; set; }

        #endregion

        #region " Retirement "

        public DbSet<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; }
        public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
        public DbSet<RetirementProfile> RetirementProfiles { get; set; }
        public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
        public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
        public DbSet<RetirementResign> RetirementResigns { get; set; }
        public DbSet<RetirementResignDoc> RetirementResignDocs { get; set; }
        public DbSet<RetirementOut> RetirementOuts { get; set; }
        public DbSet<RetirementDischarge> RetirementDischarges { get; set; }
        public DbSet<RetirementExpulsion> RetirementExpulsions { get; set; }
        public DbSet<RetirementOther> RetirementOthers { get; set; }
        public DbSet<RetirementOtherDoc> RetirementOtherDocs { get; set; }
        public DbSet<RetirementQuestion> RetirementQuestions { get; set; }

        #endregion

        #region " Probation "

        public DbSet<CronjobNotiProbation> CronjobNotiProbations { get; set; }

        #endregion

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

        public Task<int> SaveChangesAsync()
        {
            return base.SaveChangesAsync();
        }

        public void Attatch<T>(T entity) where T : class
        {
            Attach(entity);
        }
    }
}
