using CartWise.Application.Interfaces;
using CartWise.Domain.Entities;
using CartWise.Infrastructure.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace CartWise.Infrastructure.Data;

public class CartWiseDbContext : IdentityDbContext<ApplicationUser>, IApplicationDbContext
{
    public CartWiseDbContext(DbContextOptions<CartWiseDbContext> options)
        : base(options)
    {
    }

    public DbSet<Household> Households => Set<Household>();

    public DbSet<HouseholdMember> HouseholdMembers => Set<HouseholdMember>();

    public DbSet<ProductCategory> ProductCategories => Set<ProductCategory>();

    public DbSet<GroceryConcept> GroceryConcepts => Set<GroceryConcept>();

    public DbSet<ShoppingList> ShoppingLists => Set<ShoppingList>();

    public DbSet<ShoppingListItem> ShoppingListItems => Set<ShoppingListItem>();

    public DbSet<Brand> Brands => Set<Brand>();

    public DbSet<Product> Products => Set<Product>();

    public DbSet<ProductIdentifier> ProductIdentifiers => Set<ProductIdentifier>();

    public DbSet<HouseholdProductPreference> HouseholdProductPreferences => Set<HouseholdProductPreference>();

    public DbSet<Retailer> Retailers => Set<Retailer>();

    public DbSet<StoreLocation> StoreLocations => Set<StoreLocation>();

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ApplyConfigurationsFromAssembly(typeof(CartWiseDbContext).Assembly);
    }
}
