import mongoose, { Model } from 'mongoose';

import { MODEL_NAMES } from './_models';

export interface IAllocatedData {
  _id?: mongoose.Types.ObjectId;
  date: string;
  isLocked: boolean;
}

type AllocatedDataModel = Model<IAllocatedData>;

export const AllocatedDataSchema = new mongoose.Schema<IAllocatedData, AllocatedDataModel>({
  date: {
    type: String,
    required: true,
  },
  isLocked: {
    type: Boolean,
    required: true,
  },
}, { timestamps: { createdAt: true, updatedAt: false } });

export const AllocatedData = mongoose.model<IAllocatedData, AllocatedDataModel>(MODEL_NAMES.allocatedData, AllocatedDataSchema);
