// 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;
    properties;
    responses;
    types;
    models;
    enums;
    crossLanguageDefinitionIds;
    constructor() {
        this.clients = new Map();
        this.properties = new Map();
        this.responses = new Map();
        this.types = new Map();
        this.models = new Map();
        this.enums = new Map();
        this.crossLanguageDefinitionIds = new Map();
    }
    updateSdkClientReferences(sdkClient, inputClient) {
        this.clients.set(sdkClient, inputClient);
        this.crossLanguageDefinitionIds.set(sdkClient.crossLanguageDefinitionId, sdkClient.__raw.type);
    }
    updateSdkPropertyReferences(sdkProperty, inputProperty) {
        this.properties.set(sdkProperty, inputProperty);
        this.crossLanguageDefinitionIds.set(sdkProperty.crossLanguageDefinitionId, sdkProperty.__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);
        }
    }
    updateTypeCache(typeName, type) {
        if (type.kind === "model") {
            this.models.set(typeName, type);
        }
        else if (type.kind === "enum") {
            this.enums.set(typeName, type);
        }
    }
}
//# sourceMappingURL=sdk-context.js.map