"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiErrorsWidget = void 0;
const aws_cdk_lib_1 = require("aws-cdk-lib");
const error_rates_1 = require("../../metrics/api-gateway/error-rates");
class ApiErrorsWidget extends aws_cdk_lib_1.aws_cloudwatch.GraphWidget {
    constructor(props) {
        const { apiName, stage, horizontalAnnotations } = props;
        const errors = new error_rates_1.ApiGatewayErrorRatesMetric({ apiName, stage });
        super({
            title: 'Errors',
            width: 6,
            height: 4,
            left: [errors.rate4xx, errors.rate5xx],
            legendPosition: aws_cdk_lib_1.aws_cloudwatch.LegendPosition.HIDDEN,
            leftAnnotations: horizontalAnnotations !== null && horizontalAnnotations !== void 0 ? horizontalAnnotations : [],
            leftYAxis: { label: 'Percent', showUnits: false, min: 0, max: 100 },
        });
    }
}
exports.ApiErrorsWidget = ApiErrorsWidget;
