import{ulid as i}from"ulid";import{normalizeRelation as c}from"../../utils/normalize-relation.js";function a(e,o,s){const r=new Date().toISOString(),t=c({type:e.type,sourceKey:e.sourceKey,targetKey:e.targetKey,sourceVersion:e.sourceVersion,targetVersion:e.targetVersion,sourceRevision:e.sourceRevision,targetRevision:e.targetRevision});return{id:e.id||`cer_${i()}`,organizationId:o,projectId:s,sourceKey:t.sourceKey,sourceVersion:t.sourceVersion??"",sourceRevision:t.sourceRevision??"",sourceToTargetRelation:t.type,targetKey:t.targetKey,targetVersion:t.targetVersion??"",targetRevision:t.targetRevision??"",targetToSourceRelation:`reverse:${t.type}`,sourceFile:e.sourceFile||null,fileHash:e.fileHash||null,isDeleted:e.isDeleted??!1,createdAt:e.createdAt||r,updatedAt:r}}export{a as createEntityRelationDbRecordFromDto};
