"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bson_1 = require("bson");
const privateLogger_1 = require("../../../privateLogger");
class BillingLogger {
    constructor() {
        this.logger = privateLogger_1.privateLogger.child({ service: 'BillingLogger' });
        this.currency = 'TRUCREDS';
    }
    async logPromptLibraryUsage({ cost, tokenUsage, workspaceId, promptLibraryId, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging prompt library usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'prompt',
            typeId: promptLibraryId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logDatasetUsage({ cost, tokenUsage, workspaceId, datasetId, metadata, provider = 'trusys', model = 'gpt-4.1', }) {
        this.logger.info('Logging dataset usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'dataset',
            typeId: datasetId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logDatasetSampleUsage({ cost, tokenUsage, workspaceId, datasetId, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging dataset sample usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'dataset_sample',
            typeId: datasetId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logFunctionEvalUsage({ cost, tokenUsage, workspaceId, functionEvalId, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging function eval usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'functional_evaluation',
            typeId: functionEvalId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logSecurityEvalUsage({ cost, tokenUsage, workspaceId, securityEvalId, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging security eval usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'security_evaluation',
            typeId: securityEvalId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async defaultLogLineItem({ cost, tokenUsage, workspaceId, type, typeId, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging default line item', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: type ?? "other",
            typeId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logMetricUsage({ cost, tokenUsage, workspaceId, testRunId, metadata, amount, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging metric usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'metric',
            typeId: testRunId,
            currency: this.currency,
            amount,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logPluginUsage({ cost, tokenUsage, workspaceId, testRunId, metadata, amount, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging plugin usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'plugin',
            typeId: testRunId,
            currency: this.currency,
            amount,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logMonitoringMetricUsage({ tokenUsage, workspaceId, metadata, amount, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging monitoring metric usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'monitoring_metric',
            typeId: workspaceId,
            currency: this.currency,
            amount,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logMonitoringUsage({ tokenUsage, workspaceId, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging monitoring usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'monitoring',
            typeId: workspaceId,
            currency: this.currency,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logRagPoisoningUsage({ cost, tokenUsage, workspaceId, projectId, typeId, metadata, provider = 'trusys', model = 'gpt-4.1', }) {
        this.logger.info('Logging RAG poisoning usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'rag_poisoning',
            typeId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logTextToAudioUsage({ cost, tokenUsage, workspaceId, projectId, typeId, metadata, provider = 'elevenlabs', model = 'eleven_v3', }) {
        this.logger.info('Logging text-to-audio usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'text_to_audio',
            typeId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logCallUsage({ cost, tokenUsage, workspaceId, projectId, typeId, metadata, provider = 'twilio', model = 'twilio-call', }) {
        this.logger.info('Logging call usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'call_conversation',
            typeId,
            currency: this.currency,
            cost,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
    async logGuardrailUsage({ cost, tokenUsage, workspaceId, projectId, typeId, amount, metadata, provider = 'trusys', model = 'default', }) {
        this.logger.info('Logging guardrail usage', {
            id: new bson_1.ObjectId().toHexString(),
            workspaceId,
            type: 'guardrails',
            typeId,
            currency: this.currency,
            amount,
            tokenUsage,
            timestamp: new Date().toISOString(),
            metadata,
            provider,
            model,
        });
    }
}
// Singleton instance
exports.default = new BillingLogger();
//# sourceMappingURL=billing-logger.js.map