import type { AppFlags } from "./config";
import type { IFeaturesRepository } from "./features.repository.interface";
interface CacheOptions {
    ttl: number;
}
/**
 * Repository class for managing feature flags and feature access control.
 * Implements the IFeaturesRepository interface to provide feature flag functionality
 * for users, teams, and global application features.
 */
export declare class FeaturesRepository implements IFeaturesRepository {
    private static featuresCache;
    private clearCache;
    /**
     * Gets all features with their enabled status.
     * Uses caching to avoid hitting the database on every request.
     * @returns Promise<Feature[]> - Array of all features
     */
    getAllFeatures(): Promise<any[]>;
    /**
     * Gets a map of all feature flags and their enabled status.
     * Uses caching to avoid hitting the database on every request.
     * @returns Promise<AppFlags> - A map of feature flags to their enabled status
     */
    getFeatureFlagMap(): Promise<any>;
    /**
     * Checks if a feature is enabled globally in the application.
     * @param slug - The feature flag identifier to check
     * @returns Promise<boolean> - True if the feature is enabled globally, false otherwise
     * @throws Error if the feature flag check fails
     */
    checkIfFeatureIsEnabledGlobally(slug: keyof AppFlags, _options?: CacheOptions): Promise<boolean>;
    /**
     * Checks if a specific user has access to a feature.
     * Checks both direct user feature assignments and team-based feature access.
     * @param userId - The ID of the user to check
     * @param slug - The feature identifier to check
     * @returns Promise<boolean> - True if the user has access to the feature, false otherwise
     * @throws Error if the feature access check fails
     */
    checkIfUserHasFeature(userId: number, slug: string): Promise<boolean>;
    /**
     * Private helper method to check if a user belongs to any team that has access to a feature.
     * @param userId - The ID of the user to check
     * @param slug - The feature identifier to check
     * @returns Promise<boolean> - True if the user belongs to a team with the feature, false otherwise
     * @throws Error if the team feature check fails
     * @private
     */
    private checkIfUserBelongsToTeamWithFeature;
    /**
     * Checks if a team or any of its ancestors has access to a specific feature.
     * Uses a recursive CTE raw SQL query for performance.
     * @param teamId - The ID of the team to start the check from
     * @param featureId - The feature identifier to check
     * @returns Promise<boolean> - True if the team or any ancestor has the feature, false otherwise
     * @throws Error if the database query fails
     */
    checkIfTeamHasFeature(teamId: number, featureId: keyof AppFlags): Promise<boolean>;
}
export {};
//# sourceMappingURL=features.repository.d.ts.map