"use strict";var _a,_b,_c;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Model=exports.ErrorModel=exports.EmptyModel=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../core"),apigateway_generated_1=require("./apigateway.generated"),restapi_1=require("./restapi"),util=require("./util");class EmptyModel{constructor(){this.modelId="Empty"}}exports.EmptyModel=EmptyModel,_a=JSII_RTTI_SYMBOL_1,EmptyModel[_a]={fqn:"aws-cdk-lib.aws_apigateway.EmptyModel",version:"2.24.1"};class ErrorModel{constructor(){this.modelId="Error"}}exports.ErrorModel=ErrorModel,_b=JSII_RTTI_SYMBOL_1,ErrorModel[_b]={fqn:"aws-cdk-lib.aws_apigateway.ErrorModel",version:"2.24.1"};class Model extends core_1.Resource{constructor(scope,id,props){var _d;super(scope,id,{physicalName:props.modelName});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_apigateway_ModelProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.constructor),error}const modelProps={name:this.physicalName,restApiId:props.restApi.restApiId,contentType:(_d=props.contentType)!==null&&_d!==void 0?_d:"application/json",description:props.description,schema:util.JsonSchemaMapper.toCfnJsonSchema(props.schema)},resource=new apigateway_generated_1.CfnModel(this,"Resource",modelProps);this.modelId=this.getResourceNameAttribute(resource.ref);const deployment=props.restApi instanceof restapi_1.RestApi?props.restApi.latestDeployment:void 0;deployment&&(deployment.node.addDependency(resource),deployment.addToLogicalId({model:modelProps}))}static fromModelName(scope,id,modelName){class Import extends core_1.Resource{constructor(){super(...arguments),this.modelId=modelName}}return new Import(scope,id)}}exports.Model=Model,_c=JSII_RTTI_SYMBOL_1,Model[_c]={fqn:"aws-cdk-lib.aws_apigateway.Model",version:"2.24.1"},Model.ERROR_MODEL=new ErrorModel,Model.EMPTY_MODEL=new EmptyModel;
//# sourceMappingURL=model.js.map
