using Femto.Common.Infrastructure.Outbox;
using Femto.Modules.Auth.Models;
using Microsoft.EntityFrameworkCore;

namespace Femto.Modules.Auth.Data;

internal class AuthContext(DbContextOptions<AuthContext> options) : DbContext(options), IOutboxContext
{
    public virtual DbSet<UserIdentity> Users { get; set; }
    public virtual DbSet<SignupCode> SignupCodes { get; set; }
    public virtual DbSet<OutboxEntry> Outbox { get; set; }

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