"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudfrontDashboard = void 0;
const aws_cdk_lib_1 = require("aws-cdk-lib");
const widgets = require("./widgets");
class CloudfrontDashboard extends aws_cdk_lib_1.aws_cloudwatch.Dashboard {
    /**
     * Creates a dashboard with debug/informational metrics for a Cloudfront distribution.
     * It will create widgets to track requests, errors and latencies for the
     * API, all of its methods, and any lambda integrations. Assumes that method
     * names and lambda names begin with the api name.
     */
    constructor(scope, id, props) {
        const { distributionId, headerName, desc } = props;
        const defaultProps = {
            widgets: [
                [new widgets.HeaderWidget({ name: headerName, desc, height: 3 })],
                [
                    new widgets.CloudfrontRequestsWidget({ distributionId }),
                    new widgets.CloudfrontErrorsWidget({ distributionId }),
                    new widgets.CloudfrontLatencyWidget({ distributionId }),
                ],
            ],
        };
        super(scope, id, { ...defaultProps, ...props });
    }
}
exports.CloudfrontDashboard = CloudfrontDashboard;
