"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getResponse=void 0;const utils_1=require("../utils"),field_1=require("./field"),mediaContent_1=require("./mediaContent");function getResponse({parser:e,code:t,defaultAsError:s,infoOrRef:o,options:n,isEvent:i,operation:r}){const d=!!i,{resolved:a}=e.deref(o),p={code:t};void 0!==a["x-summary"]?(p.summary=(0,utils_1.getValueFromMdParsedExtension)(a,"x-summary"),p.description=(0,utils_1.getValueFromMdParsedExtension)(a,"description")||""):(p.summary=(0,utils_1.getValueFromMdParsedExtension)(a,"description")||"",p.description=""),p.type=(0,utils_1.getStatusCodeType)(t,s);const u=a.headers,l=o.$ref||utils_1.JsonPointer.join((null==r?void 0:r.pointer)||"",["responses",t]);void 0!==u&&(p.headers=Object.keys(u).map((t=>{const s=u[t];return(0,field_1.getField)(e,Object.assign(Object.assign({},s),{name:t}),utils_1.JsonPointer.join(l,["headers",t]),n,{operation:r,type:"response",response:p})})));const c=(0,utils_1.getContentWithLegacyExamples)(a);return void 0!==c&&(p.content=(0,mediaContent_1.getMediaContent)({parser:e,info:c,isRequestType:d,options:n,data:{operation:r,type:"response",response:p,absolutePointer:l}})),p}exports.getResponse=getResponse;
//# sourceMappingURL=response.js.map