import mongoose, { Schema, Document } from "mongoose";

export interface IFile extends Document {
    objectName: string;
    originalName: string;
    size: number;
    mimeType: string;
    userId: string;
    organizationId: string;
    employeeId: string;
    serviceId: string;
    appointmentId: string;
    createdAt: Date;
}

const DataFileSchema = new Schema<IFile>({
    objectName: { type: String, required: true },
    originalName: { type: String, required: true },
    size: { type: Number, required: true },
    mimeType: { type: String, required: true },
    userId: { type: String, required: false },
    organizationId: { type: String, required: false },
    employeeId: { type: String, required: false },
    serviceId: { type: String, required: false },
    appointmentId: { type: String, required: false },
    createdAt: { type: Date, default: Date.now },
});

export default mongoose.model<IFile>("File", DataFileSchema);
