
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
import { Disposable } from '../../../../base/common/lifecycle.js';
import { StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
import { IStorageService } from '../../../../platform/storage/common/storage.service.js';
import { Extensions } from '../../../services/extensionManagement/common/extensionFeatures.js';
import { IExtensionFeaturesManagementService } from '../../../services/extensionManagement/common/extensionFeatures.service.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { localize } from '../../../../nls.js';
import { Codicon } from '../../../../base/common/codicons.js';

let LanguageModelStatsService = class LanguageModelStatsService extends Disposable {
    constructor(extensionFeaturesManagementService, storageService) {
        super();
        this.extensionFeaturesManagementService = extensionFeaturesManagementService;
        for (const key in ( storageService.keys(StorageScope.APPLICATION, StorageTarget.USER))) {
            if (key.startsWith("languageModelStats.") || key.startsWith("languageModelAccess.")) {
                storageService.remove(key, StorageScope.APPLICATION);
            }
        }
    }
    async update(model, extensionId, agent, tokenCount) {
        await this.extensionFeaturesManagementService.getAccess(extensionId, CopilotUsageExtensionFeatureId);
    }
};
LanguageModelStatsService = ( __decorate([( __param(0, IExtensionFeaturesManagementService)), ( __param(1, IStorageService))], LanguageModelStatsService));
const CopilotUsageExtensionFeatureId = "copilot";
( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
    id: CopilotUsageExtensionFeatureId,
    label: ( localize(7945, "Copilot")),
    description: ( localize(7946, "Language models usage statistics of this extension.")),
    icon: Codicon.copilot,
    access: {
        canToggle: false
    },
    accessDataLabel: ( localize(7947, "chat"))
});

export { CopilotUsageExtensionFeatureId, LanguageModelStatsService };
