import{MEMBERS_MIN_LENGTH as e,NAME_MAX_LENGTH as t,NAME_MIN_LENGTH as n}from"../utils/validation/validateProject.mjs";import{Schema as r}from"mongoose";import{AiProviders as i,Locales as a}from"@intlayer/types";const o=new r({clientId:{type:String,required:!0},clientSecret:{type:String,required:!0},userId:{type:r.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}),s=new r({name:{type:String,required:!0},url:{type:String,required:!0},enabled:{type:Boolean,default:!0},secret:{type:String}},{_id:!0}),c=new r({internationalization:{locales:{type:[String],enum:Object.values(a.ALL_LOCALES),required:!0},defaultLocale:{type:String,enum:Object.values(a.ALL_LOCALES)}},editor:{applicationURL:{type:String},cmsURL:{type:String}},ai:{provider:{type:String,enum:Object.values(i)},model:{type:String},apiKey:{type:String},applicationContext:{type:String},baseURL:{type:String}}},{_id:!1}),l=new r({autoTriggerBuilds:{type:Boolean,default:!1},webhooks:[s]},{_id:!1}),u=new r({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}),d=new r({organizationId:{type:r.Types.ObjectId,ref:`Organization`,required:!0},name:{type:String,required:!0,minlength:n,maxlength:t},configuration:c,oAuth2Access:[o],repository:u,webhooks:l,membersIds:{type:[r.Types.ObjectId],ref:`User`,required:!0,minlength:e},adminsIds:{type:[r.Types.ObjectId],ref:`User`,required:!0,minlength:e},creatorId:{type:r.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{d as projectSchema};
//# sourceMappingURL=project.schema.mjs.map