import mongoose from "mongoose"; // Schema for property tax information const propertyTaxInfoSchema = mongoose.Schema({ propertytaxowned: { type: String }, ownedyear: { type: String }, taxassessed: { type: String }, taxyear: { type: String }, }); // Schema for images const imageSchema = mongoose.Schema({ title: { type: String }, // Title of the image file: { type: String }, // Uploaded image URL }); const propertySchema = mongoose.Schema({ address: { type: String, required: true }, city: { type: String, required: true }, state: { type: String, required: true }, county: { type: String, required: true }, zip: { type: String, required: true }, parcel: { type: String, required: true }, subdivision: { type: String, required: true }, legal: { type: String, required: true }, costpersqft: { type: String, required: true }, propertyType: { type: String, required: true }, lotacres: { type: String, required: true }, yearBuild: { type: String, required: true }, totallivingsqft: { type: String, required: true }, beds: { type: String, required: true }, baths: { type: String, required: true }, stories: { type: String, required: true }, garage: { type: String, required: true }, garagesqft: { type: String, required: true }, poolspa: { type: String, required: true }, fireplaces: { type: String, required: true }, ac: { type: String, required: true }, heating: { type: String, required: true }, buildingstyle: { type: String, required: true }, sitevacant: { type: String, required: true }, extwall: { type: String, required: true }, roofing: { type: String, required: true }, totalSqft: { type: String, required: true }, // Remove individual property tax fields and replace with array propertyTaxInfo: [propertyTaxInfoSchema], // Array of tax info objects images: [imageSchema], googleMapLink: { type: String }, userfirstname: String, usermiddlename: String, userlastname: String, usertitle: String, creator: String, useremail: String, propertyId: String, userId: String, createdAt: { type: Date, default: new Date(), }, publishedAt: { type: Date, default: new Date(), }, currentYear: { type: Number, default: new Date().getFullYear(), }, closeDateAtoB:{ type: Date, required: true, }, closeDateBtoC:{ type: Date, required: true, }, renovationRisk: { type: Number, required: true, }, purchaseCost: { type: Number, required: true, // Set to true if this field is mandatory }, rateofreturn :{ type: Number, required: true, // Set to true if this field is mandatory }, costPaidAtoB: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalPurchaseCosts: { type: Number, required: true, // Set to true if this field is mandatory }, credits: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalcredits: { type: Number, required: true, // Set to true if this field is mandatory }, totalPurchaseCostsaftercredits: { type: Number, required: true, // Set to true if this field is mandatory }, cashAdjustments: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalcashAdjustments:{ type: Number, required: true, // Set to true if this field is mandatory }, totalcashrequiredonsettlement:{ type: Number, required: true, // Set to true if this field is mandatory }, incidentalCost: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalincidentalCost: { type: Number, required: true, // Set to true if this field is mandatory }, carryCosts: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalcarryCosts: { type: Number, required: true, // Set to true if this field is mandatory }, renovationCost: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalrenovationCost:{ type: Number, required: true, // Set to true if this field is mandatory }, totalRenovationsandHoldingCost:{ type: Number, required: true, // Set to true if this field is mandatory }, totalCoststoBuyAtoB:{ type: Number, required: true, // Set to true if this field is mandatory }, sellingPriceBtoC:{ type: Number, required: true, // Set to true if this field is mandatory }, costPaidOutofClosing:[ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalcostPaidOutofClosing:{ type: Number, required: true, // Set to true if this field is mandatory }, totalCosttoSellBtoC:{ type: Number, required: true, // Set to true if this field is mandatory }, adjustments:[ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totaladjustments:{ type: Number, required: true, // Set to true if this field is mandatory }, fundsavailablefordistribution:{ type: Number, required: true, // Set to true if this field is mandatory }, purchaseCost:{ type: Number, required: true, // Set to true if this field is mandatory }, grossproceedsperHUD:{ type: Number, required: true, // Set to true if this field is mandatory }, incomestatement: [ { title: { type: String, required: true, // Set to true if this field is mandatory }, price: { type: Number, required: true, // Set to true if this field is mandatory }, }, ], totalincomestatement:{ type: Number, required: true, // Set to true if this field is mandatory }, netBtoCsalevalue:{ type: Number, required: true, // Set to true if this field is mandatory }, fundspriortoclosing:{ type: Number, required: true, // Set to true if this field is mandatory }, shorttermrental:{ type: Number, required: true, // Set to true if this field is mandatory }, OtherIncome:{ type: Number, required: true, // Set to true if this field is mandatory }, InsuranceClaim:{ type: Number, required: true, // Set to true if this field is mandatory }, LongTermRental:{ type: Number, required: true, // Set to true if this field is mandatory }, netprofitbeforefinancingcosts:{ type: Number, required: true, // Set to true if this field is mandatory }, FinancingCostClosingCost:{ type: Number, required: true, // Set to true if this field is mandatory }, NetProfit:{ type: Number, required: true, // Set to true if this field is mandatory }, fundDetails: [ { fundValue: { type: Number, // Adjust type if needed (String or Number) required: true, }, fundPercentage: { type: Number, // Adjust type if needed required: true, }, }, ], }); const PropertyModal = mongoose.model("property", propertySchema); export default PropertyModal;