"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lambdaSearchMetricPropsToMathExpressionProps = void 0;
const aws_cdk_lib_1 = require("aws-cdk-lib");
/**
 * Helper for mapping to actual metric props, with defaults for optionals
 */
const lambdaSearchMetricPropsToMathExpressionProps = (props, metricName, statistic) => {
    var _a;
    const period = (_a = props.period) !== null && _a !== void 0 ? _a : aws_cdk_lib_1.Duration.minutes(5);
    return {
        period: props.period,
        expression: `SEARCH('{AWS/Lambda,FunctionName} MetricName=${metricName}`
            + ` FunctionName=${props.lambdaSearchName}',`
            + ` '${statistic}', ${period.toSeconds()})`,
        label: ' ', // blank out the label so it displays the found function name
        usingMetrics: {},
    };
};
exports.lambdaSearchMetricPropsToMathExpressionProps = lambdaSearchMetricPropsToMathExpressionProps;
