const { AwsSdkSigV4Signer } = require("@aws-sdk/core/httpAuthSchemes");
const { AwsJson1_1Protocol } = require("@aws-sdk/core/protocols");
const { NoOpLogger } = require("@smithy/core/client");
const { parseUrl } = require("@smithy/core/protocols");
const { fromBase64, fromUtf8, toBase64, toUtf8 } = require("@smithy/core/serde");
const { defaultSSMHttpAuthSchemeProvider } = require("./auth/httpAuthSchemeProvider");
const { defaultEndpointResolver } = require("./endpoint/endpointResolver");
const { errorTypeRegistries } = require("./schemas/schemas_0");
exports.getRuntimeConfig = (config) => {
    return {
        apiVersion: "2014-11-06",
        base64Decoder: config?.base64Decoder ?? fromBase64,
        base64Encoder: config?.base64Encoder ?? toBase64,
        disableHostPrefix: config?.disableHostPrefix ?? false,
        endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
        extensions: config?.extensions ?? [],
        httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSSMHttpAuthSchemeProvider,
        httpAuthSchemes: config?.httpAuthSchemes ?? [
            {
                schemeId: "aws.auth#sigv4",
                identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
                signer: new AwsSdkSigV4Signer(),
            },
        ],
        logger: config?.logger ?? new NoOpLogger(),
        protocol: config?.protocol ?? AwsJson1_1Protocol,
        protocolSettings: config?.protocolSettings ?? {
            defaultNamespace: "com.amazonaws.ssm",
            errorTypeRegistries,
            xmlNamespace: "http://ssm.amazonaws.com/doc/2014-11-06/",
            version: "2014-11-06",
            serviceTarget: "AmazonSSM",
        },
        serviceId: config?.serviceId ?? "SSM",
        urlParser: config?.urlParser ?? parseUrl,
        utf8Decoder: config?.utf8Decoder ?? fromUtf8,
        utf8Encoder: config?.utf8Encoder ?? toUtf8,
    };
};
