"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LogQueryWidget=exports.LogQueryLanguage=exports.LogQueryVisualizationType=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var widget_1=()=>{var tmp=require("./widget");return widget_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},LogQueryVisualizationType;(function(LogQueryVisualizationType2){LogQueryVisualizationType2.TABLE="table",LogQueryVisualizationType2.LINE="line",LogQueryVisualizationType2.STACKEDAREA="stackedarea",LogQueryVisualizationType2.BAR="bar",LogQueryVisualizationType2.PIE="pie"})(LogQueryVisualizationType||(exports.LogQueryVisualizationType=LogQueryVisualizationType={}));var LogQueryLanguage;(function(LogQueryLanguage2){LogQueryLanguage2.LOGS_INSIGHTS="Logs",LogQueryLanguage2.SQL="SQL",LogQueryLanguage2.PPL="PPL"})(LogQueryLanguage||(exports.LogQueryLanguage=LogQueryLanguage={}));class LogQueryWidget extends widget_1().ConcreteWidget{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_cloudwatch.LogQueryWidget",version:"2.256.1"};props;constructor(props){super(props.width||6,props.height||6);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_cloudwatch_LogQueryWidgetProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,LogQueryWidget),error}if(this.props=props,props.logGroupNames.length===0)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`AtLeastOneLogGroupRequired`,"Specify at least one log group name.");if(!!props.queryString==!!props.queryLines)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`ExactlyOneQueryStringOrLines`,"Specify exactly one of 'queryString' and 'queryLines'")}toJson(){const sources=this.props.logGroupNames.map(l=>`SOURCE '${l}'`).join(" | "),query=this.props.queryLines?this.props.queryLines.join(`
| `):this.props.queryString,properties={view:this.props.view?this.props.view:LogQueryVisualizationType.TABLE,title:this.props.title,region:this.props.region||cdk().Aws.REGION,accountId:this.props.accountId,query:`${sources} | ${query}`};return this.props.queryLanguage&&(properties.queryLanguage=this.props.queryLanguage),(this.props.view===LogQueryVisualizationType.LINE||this.props.view===LogQueryVisualizationType.STACKEDAREA)&&(properties.view="timeSeries",properties.stacked=this.props.view===LogQueryVisualizationType.STACKEDAREA),[{type:"log",width:this.width,height:this.height,x:this.x,y:this.y,properties}]}}exports.LogQueryWidget=LogQueryWidget;
