using Application.Abstractions.Data;
using Domain.Entities.Common;
using Domain.Entities.Members;
using Domain.Entities.Members.Logs;
using Domain.Entities.Page;
using Domain.Entities.Page.Banner;
using Domain.Entities.Page.Faq;
using Domain.Entities.Wallets;
using Microsoft.EntityFrameworkCore;

namespace Infrastructure.Persistence
{
    public sealed class AppDbContext : DbContext, IAppDbContext
    {
        public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }

        // Config
        public DbSet<Config> Config { get; set; }

        // Page
        public DbSet<Document> Document { get; set; }
        public DbSet<Popup> Popup { get; set; }
        public DbSet<FaqCategory> FaqCategory { get; set; }
        public DbSet<FaqItem> FaqItem { get; set; }
        public DbSet<BannerPosition> BannerPosition { get; set; }
        public DbSet<BannerItem> BannerItem { get; set; }

        // Member
        public DbSet<Member> Member { get; set; }
        public DbSet<MemberGrade> MemberGrade { get; set; }
        public DbSet<MemberApprove> MemberApprove { get; set; }
        public DbSet<MemberLoginLog> MemberLoginLog { get; set; }
        public DbSet<MemberEmailChangeLog> MemberEmailChangeLog { get; set; }
        public DbSet<MemberNameChangeLog> MemberNameChangeLog { get; set; }
        public DbSet<MemberSummaryChangeLog> MemberSummaryChangeLog { get; set; }
        public DbSet<MemberIntroChangeLog> MemberIntroChangeLog { get; set; }

        // Wallet
        public DbSet<Wallet> Wallet { get; set; }
        public DbSet<WalletTransaction> WalletTransaction { get; set; }

        // Channel
        public DbSet<Channel> Channel { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            // Apply all configurations from the current assembly
            modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
        }
    }
}