import type { Db } from "@rudderhq/db";
import { costEvents } from "@rudderhq/db";
import { type BudgetServiceHooks } from "./budgets.js";
export interface CostDateRange {
    from?: Date;
    to?: Date;
}
export interface CostTrendFilter {
    agentId?: string;
    projectId?: string;
}
export declare function costService(db: Db, budgetHooks?: BudgetServiceHooks): {
    createEvent: (orgId: string, data: Omit<typeof costEvents.$inferInsert, "orgId">) => Promise<{
        issueId: string | null;
        id: string;
        orgId: string;
        createdAt: Date;
        agentId: string;
        provider: string;
        projectId: string | null;
        goalId: string | null;
        billingCode: string | null;
        model: string;
        heartbeatRunId: string | null;
        biller: string;
        billingType: string;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        costCents: number;
        occurredAt: Date;
    }>;
    summary: (orgId: string, range?: CostDateRange) => Promise<{
        orgId: string;
        spendCents: number;
        budgetCents: number;
        utilizationPercent: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        totalTokens: number;
        eventCount: number;
        tokenEventCount: number;
    }>;
    trend: (orgId: string, range?: CostDateRange, filter?: CostTrendFilter) => Promise<{
        date: string;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        totalTokens: number;
        eventCount: number;
    }[]>;
    byAgent: (orgId: string, range?: CostDateRange) => Promise<{
        agentId: string;
        agentName: string | null;
        agentIcon: string | null;
        agentRole: string | null;
        agentStatus: string | null;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        cachedInputTokenSemantics: "included_in_input";
        apiRunCount: number;
        subscriptionRunCount: number;
        subscriptionCachedInputTokens: number;
        subscriptionInputTokens: number;
        subscriptionOutputTokens: number;
    }[]>;
    byProvider: (orgId: string, range?: CostDateRange) => Promise<{
        provider: string;
        biller: string;
        billingType: string;
        model: string;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        cachedInputTokenSemantics: "included_in_input";
        apiRunCount: number;
        subscriptionRunCount: number;
        subscriptionCachedInputTokens: number;
        subscriptionInputTokens: number;
        subscriptionOutputTokens: number;
    }[]>;
    byBiller: (orgId: string, range?: CostDateRange) => Promise<{
        biller: string;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        apiRunCount: number;
        subscriptionRunCount: number;
        subscriptionCachedInputTokens: number;
        subscriptionInputTokens: number;
        subscriptionOutputTokens: number;
        providerCount: number;
        modelCount: number;
    }[]>;
    /**
     * aggregates cost_events by provider for each of three rolling windows:
     * last 5 hours, last 24 hours, last 7 days.
     * purely internal consumption data, no external rate-limit sources.
     */
    windowSpend: (orgId: string) => Promise<{
        provider: string;
        biller: string;
        window: string;
        windowHours: 5 | 24 | 168;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        cachedInputTokenSemantics: "included_in_input";
    }[]>;
    byAgentModel: (orgId: string, range?: CostDateRange) => Promise<{
        agentId: string;
        agentName: string | null;
        provider: string;
        biller: string;
        billingType: string;
        model: string;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        cachedInputTokenSemantics: "included_in_input";
    }[]>;
    byProject: (orgId: string, range?: CostDateRange) => Promise<{
        projectId: string | null;
        projectName: string;
        costCents: number;
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
    }[]>;
};
//# sourceMappingURL=costs.d.ts.map