namespace Adapters.Driven.Persistence.Context;

using Adapters.Driven.Persistence.Seeding;
using Domain.Entities;
using Microsoft.EntityFrameworkCore;

public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
    public DbSet<Student> Students => Set<Student>();
    public DbSet<Subject> Subjects => Set<Subject>();
    public DbSet<Professor> Professors => Set<Professor>();
    public DbSet<Enrollment> Enrollments => Set<Enrollment>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
        DataSeeder.Seed(modelBuilder);
        base.OnModelCreating(modelBuilder);
    }
}
