text: 'use strict';
  
  const createWidget = (config) => {
    const apiName = '${AWS::StackName}';
  
    const widget = {
      type: 'metric',
      x: config.coordinates.x,
      y: config.coordinates.y,
      width: config.coordinates.width,
      height: config.coordinates.height,
      properties: {
        title: config.title,
        view: 'singleValue',
        metrics: [
          [ 'AWS/ApiGateway', 'IntegrationLatency', 'ApiName', apiName, { stat: 'Average', period: 2592000, region: '${AWS::Region}', label: 'IntegrationLatency' } ],
          [ 'AWS/ApiGateway', 'Latency', 'ApiName', apiName, { stat: 'Average', period: 2592000, region: '${AWS::Region}', label: 'Latency' } ]
        ],
        region: '${AWS::Region}',
        period: 300
      }
    };
  
    return widget;
  };
  
  module.exports = {
    createWidget,
  };
  