import { PrismaService } from "../../../core/database/prisma/prisma.service";
import { BatchCreateRoleGrantsDto, CreateRoleGrantDto, CreateUserGrantDto, RoleGrantQueryDto, UserGrantQueryDto } from './dto';
import { AvailableTool } from './available-tools.config';
export interface EffectiveTool {
    toolName: string;
    sources: EffectiveToolSource[];
}
export type EffectiveToolSource = {
    type: 'role';
    roleId: string;
    roleName: string;
    grantId: string;
} | {
    type: 'user';
    userId: string;
    grantId: string;
    reason: string | null;
};
export interface ToolSubject {
    userId: string;
    userDisplayName: string;
    userEmail: string;
    sources: EffectiveToolSource[];
}
export declare class AIToolsService {
    private prisma;
    constructor(prisma: PrismaService);
    listRoleGrants(query: RoleGrantQueryDto): Promise<{
        id: string;
        createdAt: Date;
        updatedAt: Date;
        roleId: string;
        createdBy: string | null;
        toolName: string;
    }[]>;
    createRoleGrant(dto: CreateRoleGrantDto, actorUserId?: string): Promise<{
        role: {
            code: string;
            id: string;
            name: string;
        };
    } & {
        id: string;
        createdAt: Date;
        updatedAt: Date;
        roleId: string;
        createdBy: string | null;
        toolName: string;
    }>;
    batchCreateRoleGrants(dto: BatchCreateRoleGrantsDto, actorUserId?: string): Promise<{
        roleId: string;
        results: {
            toolName: string;
            status: "created" | "skipped";
        }[];
        createdCount: number;
        skippedCount: number;
    }>;
    deleteRoleGrant(id: string): Promise<{
        success: boolean;
    }>;
    listUserGrants(query: UserGrantQueryDto): Promise<({
        user: {
            displayName: string;
            id: string;
            username: string;
            email: string;
        };
    } & {
        id: string;
        createdAt: Date;
        userId: string;
        updatedAt: Date;
        reason: string | null;
        createdBy: string | null;
        toolName: string;
        effect: string;
    })[]>;
    createUserGrant(dto: CreateUserGrantDto, actorUserId?: string): Promise<{
        user: {
            displayName: string;
            id: string;
            username: string;
            email: string;
        };
    } & {
        id: string;
        createdAt: Date;
        userId: string;
        updatedAt: Date;
        reason: string | null;
        createdBy: string | null;
        toolName: string;
        effect: string;
    }>;
    deleteUserGrant(id: string): Promise<{
        success: boolean;
    }>;
    getAvailableTools(): AvailableTool[];
    getUserEffectiveTools(userId: string): Promise<EffectiveTool[]>;
    getToolSubjects(toolName: string): Promise<ToolSubject[]>;
    triggerSync(): {
        scheduled: true;
        message: string;
        intervalMinutes: number;
    };
    private ensureToolAvailable;
    private ensureRoleExists;
    private ensureUserExists;
    private ensureAllToolsAvailable;
    private mergeLockedSet;
    listRoleGrantsAggregated(search?: string): Promise<{
        roleId: string;
        roleName: string;
        roleCode: string;
        tools: string[];
        toolCount: number;
        updatedAt: Date;
    }[]>;
    setRoleGrants(roleId: string, inputTools: string[], actorUserId?: string): Promise<{
        roleId: string;
        tools: string[];
        added: string[];
        removed: string[];
        toolCount: number;
    }>;
    setUserGrants(userId: string, params: {
        added: string[];
        removed: string[];
        reason: string;
    }, actorUserId?: string): Promise<{
        userId: string;
        added: string[];
        removed: string[];
        reason: string;
    }>;
    getUserGrantsOverview(params: {
        orgId?: string;
        deptId?: string;
        roleIds?: string[];
        search?: string;
        hasExtra?: boolean;
        hasRevoked?: boolean;
        page?: number;
        pageSize?: number;
    }): Promise<{
        items: {
            userId: string;
            displayName: string;
            email: string;
            avatar: string | null;
            roles: {
                id: string;
                name: string;
                code: string;
            }[];
            inheritedToolCount: number;
            addedCount: number;
            removedCount: number;
            effectiveToolCount: number;
        }[];
        total: number;
        page: number;
        pageSize: number;
    }>;
    getUserEffectiveToolsV2(userId: string): Promise<{
        data: {
            toolName: string;
            category: string;
            locked: boolean;
            sources: EffectiveToolSource[] | {
                type: "locked";
                label: string;
            }[];
        }[];
        meta: {
            totalTools: number;
            lockedCount: number;
            inheritedCount: number;
            userAddedCount: number;
            userRemovedCount: number;
            userRemovedTools: string[];
        };
    }>;
}
