import { Schema, model } from 'mongoose';
const repoPolicySchema = new Schema({
    collectionName: { type: String, required: true },
    project: { type: String, required: true },
    repositoryId: { type: String, required: true },
    id: { type: Number, required: true },
    typeId: { type: String, required: true },
    createdById: { type: String, required: true },
    createdDate: { type: Date, required: true },
    isEnabled: { type: Boolean, required: true },
    isBlocking: { type: Boolean, required: true },
    isDeleted: { type: Boolean, required: true },
    refName: { type: String },
    type: { type: String, required: true },
    settings: { type: Schema.Types.Mixed },
});
// For writes
repoPolicySchema.index({
    collectionName: 1,
    project: 1,
    repositoryId: 1,
    id: 1,
});
// For reads
repoPolicySchema.index({
    collectionName: 1,
    project: 1,
    repositoryId: 1,
    refName: 1,
});
export const RepoPolicyModel = model('RepoPolicy', repoPolicySchema);
const combinedBranchPoliciesSchema = new Schema({
    collectionName: { type: String, required: true },
    project: { type: String, required: true },
    repositoryId: { type: String, required: true },
    refName: { type: String, required: true },
    conforms: { type: Boolean, required: true },
    policies: {},
});
combinedBranchPoliciesSchema.index({
    collectionName: 1,
    project: 1,
    repositoryId: 1,
    refName: 1,
});
export const CombinedBranchPoliciesModel = model('CombinedBranchPolicies', combinedBranchPoliciesSchema);
