using Application.Abstractions.Data;
using Domain.Entities.Common;
using Domain.Entities.Crypto;
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 Domain.Entities.Forum.Boards;
using Domain.Entities.Forum.Posts;
using Domain.Entities.Forum.Comments;
using Domain.Entities.Director;
using Domain.Entities.EmailVerification;
using Domain.Entities.Forum.Logs;
using Domain.Entities.News;
using Domain.Entities.Page.Popup;
using Microsoft.EntityFrameworkCore;

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

        // Admin
        public DbSet<AdminLoginLog> AdminLoginLog { get; set; }
        public DbSet<AdminAccessLog> AdminAccessLog { get; set; }

        // Crypto
        public DbSet<CoinCategory> CoinCategory { get; set; }
        public DbSet<Coin> Coin { get; set; }
        public DbSet<CoinCategoryMap> CoinCategoryMap { get; set; }
        public DbSet<CoinMarket> CoinMarket { get; set; }

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

        // Page
        public DbSet<Document> Document { get; set; }
        public DbSet<PopupPosition> PopupPosition { 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<MemberStats> MemberStats { 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; }
        public DbSet<MemberExpLog> MemberExpLog { get; set; }
        public DbSet<MemberDailyRewardCounter> MemberDailyRewardCounter { get; set; }
        public DbSet<Attendance> Attendance { get; set; }
        public DbSet<Channel> Channel { get; set; }
        public DbSet<RefreshToken> RefreshToken { get; set; }

        // EmailVerification
        public DbSet<EmailVerifyToken> EmailVerifyToken { get; set; }
        public DbSet<EmailVerifyNumber> EmailVerifyNumber { get; set; }

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

        // 게시판
        public DbSet<BoardGroup> BoardGroup { get; set; }
        public DbSet<Board> Board { get; set; }
        public DbSet<BoardMeta> BoardMeta { get; set; }
        public DbSet<BoardManager> BoardManager { get; set; }
        public DbSet<BoardPrefix> BoardPrefix { get; set; }

        // 게시글
        public DbSet<Post> Post { get; set; }
        public DbSet<PostImage> PostImage { get; set; }
        public DbSet<PostMedia> PostMedia { get; set; }
        public DbSet<PostFile> PostFile { get; set; }
        public DbSet<PostLink> PostLink { get; set; }
        public DbSet<PostReaction> PostReaction { get; set; }
        public DbSet<PostBookmark> PostBookmark { get; set; }
        public DbSet<PostReport> PostReport { get; set; }
        public DbSet<PostTag> PostTag { get; set; }
        public DbSet<Tag> Tag { get; set; }

        // 댓글
        public DbSet<Comment> Comment { get; set; }
        public DbSet<CommentFile> CommentFile { get; set; }
        public DbSet<CommentImage> CommentImage { get; set; }
        public DbSet<CommentMedia> CommentMedia { get; set; }
        public DbSet<CommentLink> CommentLink { get; set; }
        public DbSet<CommentReaction> CommentReaction { get; set; }
        public DbSet<CommentReport> CommentReport { get; set; }
        public DbSet<CommentMention> CommentMention { get; set; }

        // 뉴스
        public DbSet<RssFeedSource> RssFeedSource { get; set; }
        public DbSet<RssNewsArticle> RssNewsArticle { get; set; }

        // 게시글/댓글 로그
        public DbSet<PostUpdateLog> PostUpdateLog { get; set; }
        public DbSet<PostFileDownLog> PostFileDownLog { get; set; }
        public DbSet<PostLinkClickLog> PostLinkClickLog { get; set; }
        public DbSet<PostViewLog> PostViewLog { get; set; }
        public DbSet<CommentUpdateLog> CommentUpdateLog { get; set; }
        public DbSet<CommentFileDownLog> CommentFileDownLog { get; set; }
        public DbSet<CommentLinkClickLog> CommentLinkClickLog { get; set; }

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