import mongoose, { Document } from 'mongoose';
import { MODEL_NAMES } from './_models';

export interface IBorrowerDataTerm {
  description: string;
  advanceRate: number;
  appraisedValue: number;
}

export interface IBorrowerDataTermDoc extends IBorrowerDataTerm, Document {
}

export const BorrowerDataTermSchema = new mongoose.Schema(
  {
    description: {
      type: String,
      required: true,
    },
    appraisedValue: {
      type: Number,
    },
    advanceRate: {
      type: Number,
    },
  },
  { timestamps: false, versionKey: false },
);

export const BorrowerDataTermModel: mongoose.Model<IBorrowerDataTermDoc> = mongoose.model<IBorrowerDataTermDoc>(MODEL_NAMES.borrowerDataTerms, BorrowerDataTermSchema);
