using Microsoft.EntityFrameworkCore;
using TakeoutSaaS.Shared.Abstractions.Ids;
using TakeoutSaaS.Shared.Abstractions.Security;

namespace TakeoutSaaS.Infrastructure.App.Persistence;

/// <summary>
/// 管理端业务主库 DbContext：不启用租户全局过滤，用于跨租户查询与平台级任务。
/// </summary>
public sealed class TakeoutAdminDbContext(
    DbContextOptions<TakeoutAdminDbContext> options,
    ICurrentUserAccessor? currentUserAccessor = null,
    IIdGenerator? idGenerator = null)
    : TakeoutAppDbContext(options, currentUserAccessor, idGenerator)
{
    /// <summary>
    /// 配置实体映射关系（不启用租户过滤）。
    /// </summary>
    /// <param name="modelBuilder">模型构建器。</param>
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // 1. 构建基础模型（复用实体映射）
        OnModelCreatingCore(modelBuilder);
    }
}
