import{getOrganizationById as e}from"../../services/organization.service.mjs";import{z as t}from"zod";const n=[`name`],r=4,i=20,a=4,o=50,s=t.object({key:t.string({message:`Key must be a string.`}).min(4,`Key must be at least 4 characters long.`).max(20,`Key must be at most 20 characters long.`),name:t.string({message:`Name must be a string.`}).min(4,`Name must be at least 4 characters long.`).max(50,`Name must be at most 50 characters long.`),organizationId:t.string({message:`Organization id must be a string`})}),c=async(t,r=n)=>{let i=r.reduce((e,t)=>(e[t]=!0,e),{}),a=s.pick(i).safeParse(t),o=a.success?{}:a.error.flatten().fieldErrors;if(r.includes(`organizationId`)&&t.organizationId&&!o.organizationId)try{await e(t.organizationId.toString())||(o.organizationId=[`Organization not found`])}catch{o.organizationId=[`Organization not found`]}return o};export{i as KEY_MAX_LENGTH,r as KEY_MIN_LENGTH,o as NAME_MAX_LENGTH,a as NAME_MIN_LENGTH,c as validateTag};
//# sourceMappingURL=validateTag.mjs.map