using System.ComponentModel.DataAnnotations; using Landmark.OLA.Models.Individuals; using Landmark.OLA.Models.Assets; using Landmark.OLA.Models.Loan.Enums; using MongoDB.Bson.Serialization.Attributes; namespace Landmark.OLA.Models.Loan { [BsonIgnoreExtraElements] public class LoanApplication : OlaModel { [Required] //Nullable so that there is no default value public LoanType? LoanType { get; set; } [Required] //One Billion is an arbitrary limit but I'm pretty confidant that it will be an acceptable upper limit for a long time. [Range(minimum: 0, maximum: 1000000000)] //Nullable so that there is no default value public decimal? RequestedAmount { get; set; } //Required for Personal Signature loans. [StringLength(100)] public string PurposeOfLoanSignature { get; set; } public DateTime Date { get; private set; } [Range(minimum: 0, maximum: 1000000000)] //Required for certain loan types. Checked by FluentValidation. public int? TermLengthInMonths { get; set; } //these could be ICollection if needed, would impact builders public RealEstate RealEstate { get; set; } public Vehicle Vehicle { get; set; } public ManufacturedHome ManufacturedHome { get; set; } public Guid SecuredCardCollateralId { get; } [Required] //Nullable so that there is no default value //Values must match loan type. Checked by FluentValidation. public LoanPurpose.Purpose? Purpose { get; set; } [Required] public Individual PrimaryBorrower { get; set; } public CoApplicant CoApplicant { get; set; } public string ModFeeAccount { get; set; } //3500 is maximum crif note length [StringLength(3500)] [RegularExpression(@"[\w\d\s\.\,\&\n\r\@\-\;\'\!]*")] public string Note { get; set; } public string PrimaryContactMethod { get; set; } public string PromoCode { get; set; } public string LoanTitle { get; set; } [StringLength(3450)] public string ClientMessage { get; set; } public DateTime DisclosureDate { get; set; } public string IPAddress { get; set; } public IList Files { get; set; } public LoanApplication() { Date = DateTime.Now; SecuredCardCollateralId = Guid.NewGuid(); Files = []; } public LoanApplication(DateTime? loanDate = null, Guid? securedCardCollateralId = null, string loanId = null) { Date = loanDate ?? DateTime.Now; SecuredCardCollateralId = securedCardCollateralId ?? Guid.NewGuid(); Id = loanId ?? null; Files = []; } } }