import"../utils/validation/validateProject.mjs";import{Schema as e}from"mongoose";import{ALL_LOCALES as t}from"@intlayer/types/allLocales";import{AiProviders as n}from"@intlayer/types/config";const r=new e({clientId:{type:String,required:!0},clientSecret:{type:String,required:!0},userId:{type:e.Types.ObjectId,ref:`User`,required:!0},name:{type:String,required:!0},expiresAt:{type:Date},accessToken:{type:[String],required:!0,default:[]},grants:{type:[String],required:!0,default:[]}},{timestamps:!0}),i=new e({name:{type:String,required:!0},url:{type:String,required:!0},enabled:{type:Boolean,default:!0},secret:{type:String}},{_id:!0}),a=new e({internationalization:{locales:{type:[String],enum:Object.values(t),required:!0},defaultLocale:{type:String,enum:Object.values(t)}},editor:{applicationURL:{type:String},cmsURL:{type:String}},ai:{provider:{type:String,enum:Object.values(n)},model:{type:String},apiKey:{type:String},applicationContext:{type:String},baseURL:{type:String}}},{_id:!1}),o=new e({autoTriggerBuilds:{type:Boolean,default:!1},webhooks:[i]},{_id:!1}),s=new e({provider:{type:String,enum:[`github`,`gitlab`,`bitbucket`],required:!0},owner:{type:String,required:!0},repository:{type:String,required:!0},branch:{type:String,default:`main`},url:{type:String,required:!0},configFilePath:{type:String,required:!0},installationId:{type:Number},projectId:{type:Number},instanceUrl:{type:String},workspace:{type:String}},{_id:!1}),c=new e({organizationId:{type:e.Types.ObjectId,ref:`Organization`,required:!0},name:{type:String,required:!0,minlength:4,maxlength:100},configuration:a,oAuth2Access:[r],repository:s,webhooks:o,imageUrl:{type:String},membersIds:{type:[e.Types.ObjectId],ref:`User`,required:!0,minlength:1},adminsIds:{type:[e.Types.ObjectId],ref:`User`,required:!0,minlength:1},creatorId:{type:e.Types.ObjectId,ref:`User`,required:!0}},{timestamps:!0,toJSON:{virtuals:!0,versionKey:!1,transform(e,t){let{_id:n,...r}=t;return{...r,id:n.toString()}}},toObject:{virtuals:!0,transform(e,t){let{_id:n,...r}=t;return{...r,id:n}}}});export{c as projectSchema};
//# sourceMappingURL=project.schema.mjs.map