import { Schema, model } from 'mongoose';
const commitMeta = {
    name: { type: String },
    email: { type: String, required: true },
    date: { type: Date, required: true },
    imageUrl: { type: String },
};
const commitSchema = new Schema({
    collectionName: { type: String, required: true },
    project: { type: String, required: true },
    repositoryId: { type: String, required: true },
    commitId: { type: String, required: true },
    author: commitMeta,
    committer: commitMeta,
    changeCounts: {
        add: { type: Number, required: true },
        edit: { type: Number, required: true },
        delete: { type: Number, required: true },
    },
    url: { type: String, required: true },
    remoteUrl: { type: String, required: true },
}, { timestamps: true });
commitSchema.index({
    'collectionName': 1,
    'project': 1,
    'repositoryId': 1,
    'author.date': 1,
});
commitSchema.index({
    collectionName: 1,
    project: 1,
    repositoryId: 1,
    commitId: 1,
}, { unique: true });
export const CommitModel = model('Commit', commitSchema);
