import { AuditService } from '../audit/audit.service';
import { AppConfig } from '../common/config/configuration';
import { PrismaService } from '../common/prisma/prisma.service';
import { DashboardRangeKey } from './analytics.rules';
export declare class AnalyticsService {
    private readonly prisma;
    private readonly audit;
    private readonly config;
    constructor(prisma: PrismaService, audit: AuditService, config: AppConfig);
    summary(): Promise<{
        registered: number;
        active: number;
        jobs: number;
        demoJobs: number;
        applications: number;
        resumes: number;
        coverLetters: number;
        interviews: number;
        matches: number;
        messages: number;
        communities: number;
        events: number;
        blocks: number;
        openReports: number;
        growth: {
            start: string;
            count: number;
        }[];
        retentionPercent: number | null;
        retentionCohort: number;
        ai: {
            calls: number;
            inputTokens: number;
            outputTokens: number;
            estimatedCost: string;
            byFeature: {
                feature: string;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
        };
    }>;
    dashboard(input: {
        range?: string;
        from?: string;
        to?: string;
        adminId?: string;
    }): Promise<{
        range: {
            key: DashboardRangeKey;
            label: string;
            from: string;
            to: string;
            granularity: "week" | "day" | "hour" | "month";
        };
        operator: {
            id: string;
            email: string;
            name: string;
        } | null;
        generatedAt: string;
        kpis: {
            registered: {
                total: number;
                inRange: number;
                deltaPercent: number;
                activeInRange: number;
                weekNew: number;
                verifiedPercent: number;
            };
            jobs: {
                live: number;
                demo: number;
                licensed: number;
                inRange: number;
                deltaPercent: number;
            };
            applications: {
                total: number;
                inRange: number;
                deltaPercent: number;
                interviews: number;
                matches: number;
                resumes: number;
                coverLetters: number;
            };
            ai: {
                calls: number;
                deltaPercent: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
                avgLatencyMs: number;
                previousTokens: number;
                currentTokens: number;
            };
        };
        series: {
            applications: {
                start: string;
                count: number;
            }[];
            registrations: {
                start: string;
                count: number;
            }[];
            ai: {
                start: string;
                count: number;
            }[];
            communities: {
                start: string;
                count: number;
            }[];
        };
        funnel: {
            fetched: number;
            accepted: number;
            rejected: number;
            dedupeRate: number;
            classified: number;
            live: number;
            importBatches: number;
            previousAccepted: number;
            latest: {
                id: string;
                source: string;
                status: string;
                accepted: number;
                rejected: number;
                createdAt: string;
            }[];
        };
        health: {
            overall: string;
            apiLatencyMs: number;
            aiConfigured: boolean;
            openReports: number;
            sources: {
                name: string;
                enabled: boolean;
                configured: boolean;
                lastSyncedAt: string | null;
                lastError: string | null;
                lastImport: {
                    accepted: number;
                    rejected: number;
                    createdAt: string;
                } | null;
                status: string;
            }[];
            uptimeLabel: string;
        };
        civic: {
            communities: number;
            communitiesInRange: number;
            events: number;
            messages: number;
            blocks: number;
        };
        importOps: {
            today: number;
            week: number;
            successRate: number;
            byOrigin: {
                ADMIN: number;
                USER: number;
                EXTERNAL: number;
            };
            topSources: {
                name: string;
                displayName: string;
                runs: number;
                accepted: number;
            }[];
        };
        activity: {
            id: string;
            category: "system" | "jobs" | "security" | "moderation";
            action: string;
            actorType: string;
            entityType: string;
            entityId: string | null;
            createdAt: string;
            summary: string;
            icon: string;
            tone: string;
        }[];
        insight: {
            text: string;
            href: string;
        };
    }>;
    ai(): Promise<{
        configured: boolean;
        provider: string | null;
        openai: {
            configured: boolean;
            credentialSource: string;
            model: string;
        };
        plans: {
            free: {
                code: string;
                name: string;
                monthlyAiQuota: number;
            };
        };
        usage: {
            calls: number;
            inputTokens: number;
            outputTokens: number;
            estimatedCost: string;
            byFeature: {
                feature: string;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
        };
        templates: {
            id: string;
            feature: string;
            version: number;
            body: string;
        }[];
    }>;
    aiServices(): Promise<{
        configured: boolean;
        activeProvider: string | null;
        routing: {
            preferredEnv: string | null;
            resolutionOrder: string[];
            note: string;
        };
        openai: {
            configured: boolean;
            credentialSource: string;
            model: string;
        };
        plans: {
            free: {
                code: string;
                name: string;
                monthlyAiQuota: number;
            };
        };
        usage: {
            calls: number;
            inputTokens: number;
            outputTokens: number;
            estimatedCost: string;
            byFeature: {
                feature: string;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
        };
        providers: {
            id: string;
            label: string;
            description: string;
            envVar: string;
            editable: boolean;
            configured: boolean;
            credentialSource: string;
            active: boolean;
            defaultModel: string;
            configuredModel: string;
            models: {
                id: string;
                label: string;
                inputPerMillion: number;
                outputPerMillion: number;
                recommended: boolean;
                tier: string;
            }[];
            recent: {
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            };
        }[];
        modelsInUse: {
            provider: string;
            model: string;
            calls: number;
            inputTokens: number;
            outputTokens: number;
            estimatedCost: string;
        }[];
        features: {
            feature: string;
            templateId: string | null;
            version: number;
            hasTemplate: boolean;
            calls: number;
            estimatedCost: string;
        }[];
        templates: {
            id: string;
            feature: string;
            version: number;
            body: string;
        }[];
        health: {
            providersConfigured: number;
            providersTotal: number;
            freePlanSubscribers: number;
            callsLast30d: number;
            templates: number;
        };
    }>;
    aiUsage(input: {
        range?: string;
        from?: string;
        to?: string;
        feature?: string;
        provider?: string;
        model?: string;
        q?: string;
        limit?: number;
        offset?: number;
    }): Promise<{
        range: {
            key: DashboardRangeKey;
            label: string;
            from: string;
            to: string;
            granularity: "week" | "day" | "hour" | "month";
        };
        generatedAt: string;
        currency: string;
        kpis: {
            calls: number;
            callsDeltaPercent: number;
            inputTokens: number;
            outputTokens: number;
            tokens: number;
            tokensDeltaPercent: number;
            estimatedCost: string;
            costDeltaPercent: number;
            avgCostPerCall: string;
            avgTokensPerCall: number;
            previous: {
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            };
        };
        series: {
            calls: {
                start: string;
                count: number;
            }[];
            cost: {
                start: string;
                count: number;
                estimatedCost: string;
            }[];
            tokens: {
                start: string;
                count: number;
            }[];
        };
        breakdown: {
            byFeature: {
                feature: string;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
            byProvider: {
                provider: string;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
            byModel: {
                provider: string;
                model: string;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
            topUsers: {
                userId: string;
                email: string | null;
                displayName: string | null;
                photoFileId: string | null;
                calls: number;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
            }[];
        };
        facets: {
            features: string[];
            providers: string[];
            models: string[];
        };
        log: {
            total: number;
            limit: number;
            offset: number;
            items: {
                id: string;
                userId: string;
                email: string;
                displayName: string | null;
                photoFileId: string | null;
                feature: string;
                provider: string;
                model: string;
                inputTokens: number;
                outputTokens: number;
                estimatedCost: string;
                createdAt: string;
                hasGeneration: boolean;
            }[];
        };
    }>;
    saveFreePlanQuota(adminId: string, monthlyAiQuota: number): Promise<{
        code: string;
        name: string;
        monthlyAiQuota: number;
    }>;
    saveOpenAi(adminId: string, input: {
        apiKey?: string;
        model?: string;
        clearCredentials?: boolean;
    }): Promise<{
        configured: boolean;
        credentialSource: string;
        model: string;
    }>;
    updateTemplate(adminId: string, id: string, body: string): Promise<{
        id: string;
        feature: string;
        version: number;
        body: string;
    }>;
}
