using PowderCoating.Core.Entities;

namespace PowderCoating.Core.Interfaces;

/// <summary>
/// Provides context about the current tenant (company) in the multi-tenant system
/// </summary>
public interface ITenantContext
{
    /// <summary>
    /// Gets the current company ID from the authenticated user's claims
    /// </summary>
    /// <returns>The company ID if user is authenticated, null otherwise</returns>
    int? GetCurrentCompanyId();

    /// <summary>
    /// Gets the full company entity for the current user
    /// </summary>
    /// <returns>The company entity if user is authenticated, null otherwise</returns>
    Task<Company?> GetCurrentCompanyAsync();

    /// <summary>
    /// Checks if the current user is a SuperAdmin (platform administrator)
    /// </summary>
    /// <returns>True if user is SuperAdmin, false otherwise</returns>
    bool IsSuperAdmin();

    /// <summary>
    /// Returns true only for SuperAdmins tied to the platform demo company (ID 1).
    /// Platform admins have unrestricted cross-company data access.
    /// Company SuperAdmins (CompanyId != 1) are scoped to their own company's data.
    /// </summary>
    bool IsPlatformAdmin();

    /// <summary>
    /// Gets the metric system preference for the current company
    /// </summary>
    /// <returns>True if metric system is enabled, false for imperial system</returns>
    Task<bool> UseMetricSystemAsync();
}
