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

export interface IBorrowerDataReceivable {
  description: string;
  advanceRate: number;
  creditInsurance: boolean;
}

export interface IBorrowerDataReceivableDoc extends IBorrowerDataReceivable, Document {
}

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

export const BorrowerDataReceivableModel: mongoose.Model<IBorrowerDataReceivableDoc> = mongoose.model<IBorrowerDataReceivableDoc>(MODEL_NAMES.borrowerDataReceivables, BorrowerDataReceivableSchema);
