using Femto.Common.Infrastructure.Outbox;
using Femto.Modules.Blog.Domain.Authors;
using Femto.Modules.Blog.Domain.Posts;
using Microsoft.EntityFrameworkCore;

namespace Femto.Modules.Blog.Application;

internal class BlogContext(DbContextOptions<BlogContext> options) : DbContext(options), IOutboxContext
{
    public virtual DbSet<Post> Posts { get; set; }
    public virtual DbSet<Author> Authors { get; set; }
    public virtual DbSet<OutboxEntry> Outbox { get; set; }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        builder.HasDefaultSchema("blog");
        builder.ApplyConfigurationsFromAssembly(typeof(BlogContext).Assembly);
    }
}