import{getStatusCodeType as h,getContentWithLegacyExamples as x,JsonPointer as c,getValueFromMdParsedExtension as d}from"../utils/index.js";import{getField as C}from"./field.js";import{getMediaContent as j}from"./mediaContent.js";function F({parser:n,code:s,defaultAsError:f,infoOrRef:m,options:p,isEvent:y,operation:o}){const g=!!y,{resolved:t}=n.deref(m),e={code:s};t["x-summary"]!==void 0?(e.summary=d(t,"x-summary"),e.description=d(t,"description")||""):(e.summary=d(t,"description")||"",e.description=""),e.type=h(s,f);const r=t.headers,a=m.$ref||c.join(o?.pointer||"",["responses",s]);r!==void 0&&(e.headers=Object.keys(r).map(i=>{const l=r[i];return C(n,{...l,name:i},c.join(a,["headers",i]),p,{operation:o,type:"response",response:e})}));const u=x(t);return u!==void 0&&(e.content=j({parser:n,info:u,isRequestType:g,options:p,data:{operation:o,type:"response",response:e,absolutePointer:a}})),e}export{F as getResponse};
