import { model, Schema } from 'mongoose';
const buildDefinitionSchema = new Schema({
    collectionName: { type: String, required: true },
    project: { type: String, required: true },
    id: { type: Number, required: true },
    projectId: { type: String, required: true },
    repositoryId: { type: String },
    name: { type: String, required: true },
    createdDate: { type: Date },
    queueStatus: { type: String, required: true },
    revision: { type: Number, required: true },
    type: { type: String, required: true },
    uri: { type: String, required: true },
    url: { type: String, required: true },
    latestBuild: {
        id: { type: Number, required: true },
        status: { type: String, required: true },
        result: { type: String, required: true },
        queueTime: { type: Date, required: true },
        startTime: { type: Date, required: true },
        finishTime: { type: Date, required: true },
    },
    latestCompletedBuild: {
        id: { type: Number, required: true },
        status: { type: String, required: true },
        result: { type: String, required: true },
        queueTime: { type: Date, required: true },
        startTime: { type: Date, required: true },
        finishTime: { type: Date, required: true },
    },
    process: {
        processType: { type: Number, required: true },
        yamlFilename: { type: String },
    },
}, { timestamps: true });
buildDefinitionSchema.index({
    collectionName: 1,
    project: 1,
    repositoryId: 1,
});
buildDefinitionSchema.index({
    collectionName: 1,
    project: 1,
    id: 1,
});
export const BuildDefinitionModel = model('BuildDefinition', buildDefinitionSchema);
