
import { Schema, model } from 'mongoose';

// 1. Create an interface representing a document in MongoDB.
interface IBoulder {
    boulderRouteTitle: string;
    boulderRouteDescription: string;
    routeDifficulty: number;
    boulderRouteDone: boolean;
    imgName: String,
    img:
        {
            data: Buffer,
            contentType: String
        }
    boulderRouteCreated: Date;

}

const BoulderSchema = new Schema<IBoulder>({
    boulderRouteTitle: {
        type: String,
        required: true,
    },
    boulderRouteDescription: {
        type: String,
        required: true
    },
    routeDifficulty: {
        type: Number,
        required: true
    },
    boulderRouteDone: {
        type: Boolean,
        default: false
    },
    imgName: {
        type: String
    },
    img:
        {
            data: Buffer,
            contentType: String
        },
    boulderRouteCreated: {
        type: Date,
        default: Date.now
    },
})

export const Boulder = model<IBoulder>('boulder', BoulderSchema);