import{ulid as u}from"ulid";import{VERSION_NOT_SPECIFIED as c}from"@redocly/theme/core/constants";function n({entity:s,organizationId:a,projectId:l,source:e,sourceFile:i,fileHash:o}){const r=new Date().toISOString();return{id:s.id||`ce_${u()}`,organizationId:a,projectId:l,key:s.key,type:s.type,title:s.title,summary:s.summary||null,tags:s.tags?JSON.stringify(s.tags):null,metadata:s.metadata?JSON.stringify(s.metadata):null,git:s.git?JSON.stringify(s.git):null,contact:s.contact?JSON.stringify(s.contact):null,links:s.links?JSON.stringify(s.links):null,createdAt:s.createdAt||r,updatedAt:r,source:e||"file",sourceFile:i||null,fileHash:o||null,version:s.version??c,revision:s.revision??"",hash:s.hash,isCurrent:s.isCurrent,isDefaultVersion:s.isDefaultVersion??!1,isDeleted:s.isDeleted??!1,scorecardsStatus:"OUTDATED"}}export{n as createEntityDbRecord};
