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

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

        public DbSet<Config> Config { get; set; }
        public DbSet<Document> Document { get; set; } = null!;
        public DbSet<Popup> Popup { get; set; } = null!;
        public DbSet<FaqCategory> FaqCategory { get; set; } = null!;
        public DbSet<FaqItem> FaqItem { get; set; } = null!;
        public DbSet<BannerPosition> BannerPosition { get; set; } = null!;
        public DbSet<BannerItem> BannerItem { get; set; } = null!;

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