// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
/**
 * Creates a new CSharp emitter context.
 * @param context - The SDK context.
 * @param logger - The logger to use.
 * @returns The CSharp emitter context.
 * @beta
 */
export function createCSharpEmitterContext(context, logger) {
    return {
        ...context,
        logger,
        __typeCache: new SdkTypeCache(),
    };
}
class SdkTypeCache {
    clients;
    methods;
    operations;
    methodParmeters;
    operationParameters;
    properties;
    responses;
    types;
    constants;
    crossLanguageDefinitionIds;
    namespaces;
    constructor() {
        this.clients = new Map();
        this.methods = new Map();
        this.operations = new Map();
        this.methodParmeters = new Map();
        this.operationParameters = new Map();
        this.properties = new Map();
        this.responses = new Map();
        this.types = new Map();
        this.constants = new Map();
        this.crossLanguageDefinitionIds = new Map();
        this.namespaces = new Map();
    }
    updateSdkClientReferences(sdkClient, inputClient) {
        this.clients.set(sdkClient, inputClient);
        this.crossLanguageDefinitionIds.set(sdkClient.crossLanguageDefinitionId, sdkClient.__raw.type);
    }
    updateSdkMethodReferences(sdkMethod, inputMethod) {
        this.methods.set(sdkMethod, inputMethod);
        this.crossLanguageDefinitionIds.set(sdkMethod.crossLanguageDefinitionId, sdkMethod.__raw);
    }
    updateSdkOperationReferences(sdkOperation, inputMethod) {
        this.operations.set(sdkOperation, inputMethod);
    }
    updateSdkPropertyReferences(sdkProperty, inputProperty) {
        this.properties.set(sdkProperty, inputProperty);
        this.crossLanguageDefinitionIds.set(sdkProperty.crossLanguageDefinitionId, sdkProperty.__raw);
    }
    updateSdkOperationParameterReferences(sdkParameter, inputParameter) {
        this.operationParameters.set(sdkParameter, inputParameter);
        this.crossLanguageDefinitionIds.set(sdkParameter.crossLanguageDefinitionId, sdkParameter.__raw);
    }
    updateSdkMethodParameterReferences(sdkMethodParameter, inputParameter) {
        this.methodParmeters.set(sdkMethodParameter, inputParameter);
        this.crossLanguageDefinitionIds.set(sdkMethodParameter.crossLanguageDefinitionId, sdkMethodParameter.__raw);
    }
    updateSdkResponseReferences(sdkResponse, response) {
        this.responses.set(sdkResponse, response);
        // the response of an operation is not something defined in the typespec concept therefore it does not have crossLanguageDefinitionId
    }
    updateSdkTypeReferences(sdkType, inputType) {
        this.types.set(sdkType, inputType);
        if ("crossLanguageDefinitionId" in sdkType) {
            this.crossLanguageDefinitionIds.set(sdkType.crossLanguageDefinitionId, sdkType.__raw);
        }
    }
    updateConstantCache(sdkType, type) {
        this.constants.set(sdkType, type);
    }
    updateNamespaceCache(sdkNamespace, inputNamespace) {
        this.namespaces.set(sdkNamespace.fullName, inputNamespace);
        this.crossLanguageDefinitionIds.set(sdkNamespace.fullName, sdkNamespace.__raw);
    }
}
//# sourceMappingURL=sdk-context.js.map