import { BaseEngine, IMetadataProvider, UserInfo } from "@memberjunction/core";
import { MJDashboardEntityExtended } from "../custom/MJDashboardEntityExtended.js";
import { MJDashboardCategoryEntity, MJDashboardPartTypeEntity, MJDashboardUserPreferenceEntity, MJDashboardUserStateEntity, MJDashboardPermissionEntity, MJDashboardCategoryPermissionEntity, MJDashboardCategoryLinkEntity } from "../generated/entity_subclasses.js";
/**
 * Represents the effective permissions a user has on a dashboard
 */
export interface DashboardUserPermissions {
    /** The dashboard ID these permissions apply to */
    DashboardID: string;
    /** Whether the user can view the dashboard */
    CanRead: boolean;
    /** Whether the user can modify the dashboard */
    CanEdit: boolean;
    /** Whether the user can delete the dashboard */
    CanDelete: boolean;
    /** Whether the user can share the dashboard with others */
    CanShare: boolean;
    /** Whether the user is the owner of the dashboard */
    IsOwner: boolean;
    /** Source of the permission: 'owner', 'direct', 'category', or 'none' */
    PermissionSource: 'owner' | 'direct' | 'category' | 'none';
}
/**
 * Represents the effective permissions a user has on a dashboard category
 */
export interface DashboardCategoryUserPermissions {
    /** The category ID these permissions apply to */
    CategoryID: string;
    /** Whether the user can view dashboards in the category */
    CanRead: boolean;
    /** Whether the user can modify dashboards in the category */
    CanEdit: boolean;
    /** Whether the user can add/remove dashboards in the category */
    CanAddRemove: boolean;
    /** Whether the user can share the category with others */
    CanShare: boolean;
    /** Whether the user is the owner of the category */
    IsOwner: boolean;
    /** Source of the permission: 'owner', 'direct', or 'none' */
    PermissionSource: 'owner' | 'direct' | 'none';
}
/**
 * Caching of metadata for dashboards and related data, including permission management
 */
export declare class DashboardEngine extends BaseEngine<DashboardEngine> {
    /**
     * Returns the global instance of the class. This is a singleton class, so there is only one instance of it in the application. Do not directly create new instances of it, always use this method to get the instance.
     */
    static get Instance(): DashboardEngine;
    private _dashboards;
    private _partTypes;
    private _dashboardUserPreferences;
    private _dashboardCategories;
    private _dashboardUserStates;
    private _dashboardPermissions;
    private _dashboardCategoryPermissions;
    private _dashboardCategoryLinks;
    Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
    get Dashboards(): MJDashboardEntityExtended[];
    get DashboardPartTypes(): MJDashboardPartTypeEntity[];
    get DashboardUserPreferences(): MJDashboardUserPreferenceEntity[];
    get DashboardCategories(): MJDashboardCategoryEntity[];
    get DashboardUserStates(): MJDashboardUserStateEntity[];
    get DashboardPermissions(): MJDashboardPermissionEntity[];
    get DashboardCategoryPermissions(): MJDashboardCategoryPermissionEntity[];
    get DashboardCategoryLinks(): MJDashboardCategoryLinkEntity[];
    /**
     * Gets the effective permissions for a user on a specific dashboard.
     * Permission priority: Owner > Direct Permission > Category Permission
     * @param dashboardId - The ID of the dashboard
     * @param userId - The ID of the user to check permissions for
     * @returns The effective permissions for the user on this dashboard
     */
    GetDashboardPermissions(dashboardId: string, userId: string): DashboardUserPermissions;
    /**
     * Gets the effective permissions for a user on a specific dashboard category.
     * @param categoryId - The ID of the category
     * @param userId - The ID of the user to check permissions for
     * @returns The effective permissions for the user on this category
     */
    GetCategoryPermissions(categoryId: string, userId: string): DashboardCategoryUserPermissions;
    /**
     * Checks if a user can read/view a dashboard
     * @param dashboardId - The ID of the dashboard
     * @param userId - The ID of the user
     * @returns true if the user can read the dashboard
     */
    CanUserReadDashboard(dashboardId: string, userId: string): boolean;
    /**
     * Checks if a user can edit a dashboard
     * @param dashboardId - The ID of the dashboard
     * @param userId - The ID of the user
     * @returns true if the user can edit the dashboard
     */
    CanUserEditDashboard(dashboardId: string, userId: string): boolean;
    /**
     * Checks if a user can delete a dashboard
     * @param dashboardId - The ID of the dashboard
     * @param userId - The ID of the user
     * @returns true if the user can delete the dashboard
     */
    CanUserDeleteDashboard(dashboardId: string, userId: string): boolean;
    /**
     * Checks if a user can share a dashboard
     * @param dashboardId - The ID of the dashboard
     * @param userId - The ID of the user
     * @returns true if the user can share the dashboard
     */
    CanUserShareDashboard(dashboardId: string, userId: string): boolean;
    /**
     * Gets all dashboards the user has read access to (owned or shared)
     * @param userId - The ID of the user
     * @returns Array of dashboards the user can read
     */
    GetAccessibleDashboards(userId: string): MJDashboardEntityExtended[];
    /**
     * Gets all dashboard category links for a user (shared dashboards linked to their folder structure)
     * @param userId - The ID of the user
     * @returns Array of category links for the user
     */
    GetUserCategoryLinks(userId: string): MJDashboardCategoryLinkEntity[];
    /**
     * Gets the dashboards shared with a specific user (excludes owned dashboards)
     * @param userId - The ID of the user
     * @returns Array of dashboards shared with the user
     */
    GetSharedDashboards(userId: string): MJDashboardEntityExtended[];
    /**
     * Gets the users a dashboard is shared with and their permissions
     * @param dashboardId - The ID of the dashboard
     * @returns Array of permission records for this dashboard
     */
    GetDashboardShares(dashboardId: string): MJDashboardPermissionEntity[];
    /**
     * Gets the users a category is shared with and their permissions
     * @param categoryId - The ID of the category
     * @returns Array of permission records for this category
     */
    GetCategoryShares(categoryId: string): MJDashboardCategoryPermissionEntity[];
    /**
     * Checks if a user can access a category (view it in their category list).
     * A user can access a category if they:
     * 1. Own the category (category.UserID === userId)
     * 2. Have direct permission on the category
     * @param categoryId - The ID of the category
     * @param userId - The ID of the user
     * @returns true if the user can access the category
     */
    CanUserAccessCategory(categoryId: string, userId: string): boolean;
    /**
     * Gets all categories the user has access to (owned or shared).
     * Only returns categories the user explicitly owns or has permissions on.
     * @param userId - The ID of the user
     * @returns Array of categories the user can access
     */
    GetAccessibleCategories(userId: string): MJDashboardCategoryEntity[];
}
//# sourceMappingURL=dashboards.d.ts.map