"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.apiGatewayMetricPropsToMetricProps = void 0;
const aws_cdk_lib_1 = require("aws-cdk-lib");
/**
 * Helper for mapping IApiMetricProps to actual metric props, with defaults for optionals
 */
const apiGatewayMetricPropsToMetricProps = (props, metricName, label, statistic) => {
    var _a;
    return ({
        metricName,
        label,
        statistic,
        namespace: 'AWS/ApiGateway',
        period: (_a = props.period) !== null && _a !== void 0 ? _a : aws_cdk_lib_1.Duration.minutes(5),
        color: props.color,
        dimensionsMap: {
            ...{
                ApiName: props.apiName,
                Stage: props.stage, // TODO: Stage should be optional?
            },
            ...(props.path ? { Resource: props.path } : {}), // Merge Resource path into dimensions if given
            ...(props.method ? { Method: props.method } : {}), // Merge Resource method into dimensions if given
        },
    });
};
exports.apiGatewayMetricPropsToMetricProps = apiGatewayMetricPropsToMetricProps;
