"use strict";
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.addCompleterV2 = exports.tweakModel = void 0;
const linq_1 = require("@azure-tools/linq");
const model_state_1 = require("../utils/model-state");
const codegen_1 = require("@azure-tools/codegen");
const resourceGroupNames = new Set([
    'resourcegroupname',
    'resourcegroup',
]);
const subscriptionIdNames = new Set([
    'subscriptionid',
]);
const locationNames = new Set([
    'location',
]);
async function tweakModel(state) {
    const model = state.model;
    for (const operation of (0, linq_1.values)(model.commands.operations)) {
        for (const parameter of (0, linq_1.values)(operation.parameters)) {
            const parameterName = parameter.details.csharp.name.toLowerCase();
            if (resourceGroupNames.has(parameterName)) {
                parameter.details.csharp.completer = 'ResourceGroup';
            }
            if (subscriptionIdNames.has(parameterName)) {
                parameter.details.csharp.completer = 'SubscriptionId';
            }
            if (locationNames.has(parameterName)) {
                parameter.details.csharp.completer = 'Location';
            }
            // 'Resource'
            // 'ResourceId' 
        }
    }
    return model;
}
exports.tweakModel = tweakModel;
async function addCompleterV2(service) {
    const state = await new model_state_1.ModelState(service).init();
    await service.writeFile({ filename: 'code-model-v4-add-azure-completers-v2.yaml', content: (0, codegen_1.serialize)(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4' });
}
exports.addCompleterV2 = addCompleterV2;
//# sourceMappingURL=add-azure-completers-v2.js.map