import mongoose, {Schema} from 'mongoose';
import * as crypto from "crypto";

export interface IMedia {
    assetId: string
    clientId: number
    assetName: string
    assetEnding: string
    assetDescription: string
    created: Date
}

const MediaSchema = new Schema<IMedia>({
    assetId: {
        type: String,
        default: () => crypto.randomBytes(12).toString('hex')
    },
    clientId: {
        type: Number,
        required: true
    },
    assetName: {
        type: String,
        default: "Sheepstar Asset"
    },
    assetDescription: {
        type: String,
        default: "Well I dont know what this is for"
    },
    assetEnding: {
        type: String,
        default: "txt"
    },
    created: {
        type: Date,
        default: Date.now
    }
});

export const Media = mongoose.model('media', MediaSchema);