using TakeoutSaaS.Shared.Abstractions.Tenancy;

namespace TakeoutSaaS.Module.Tenancy;

/// <summary>
/// 默认租户提供者：基于租户上下文访问器暴露当前租户 ID。
/// </summary>
/// <remarks>
/// 初始化租户提供者。
/// </remarks>
/// <param name="tenantContextAccessor">租户上下文访问器</param>
public sealed class TenantProvider(ITenantContextAccessor tenantContextAccessor) : ITenantProvider
{
    /// <inheritdoc />
    public long GetCurrentTenantId()
        => tenantContextAccessor.Current?.TenantId ?? 0;
}
