import{validateArray as e}from"./validateArray.mjs";import{validateString as t}from"./validateString.mjs";import{getOrganizationById as n}from"../../services/organization.service.mjs";const r=[`name`,`membersIds`,`adminsIds`,`organizationId`],i=4,a=100,o=1,s=async(i,a=r)=>{let o={},s=new Set(a),c=JSON.parse(JSON.stringify(i));for(let r of s){let a=c[r];if(o[r]=[],r===`name`){let e=t(a,`Name`,4,100);e.length>0&&(o[r]=e)}if(r===`organizationId`){let e=await n(r),t=[];typeof a!=`string`&&t.push(`Organization id must be a string`),a||t.push(`Organization id is required`),e||t.push(`Organization not found`),t.length>0&&(o[r]=t)}if(r===`membersIds`||r===`adminsIds`)if(!i.organizationId)o[r]=[`Organization id is required to validate project members`];else{let t=await n(i.organizationId),s=e(a,`Members`,`string`,e=>(t?.membersIds).includes(e),1);s.length>0&&(o[r]=s)}o[r].length===0&&delete o[r]}return o};export{o as MEMBERS_MIN_LENGTH,a as NAME_MAX_LENGTH,i as NAME_MIN_LENGTH,s as validateProject};
//# sourceMappingURL=validateProject.mjs.map