Files
monorepo/LCU.API.Internal.RepoApi/LCU.API.Internal.RepoApi.Repos/Persistence/AppDbContext.cs
T
2026-03-13 09:27:34 -05:00

413 lines
28 KiB
C#

using Microsoft.EntityFrameworkCore;
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
using LCU.API.Internal.RepoApi.Repos.Models;
using LCU.API.Collections.CollectionsApiLib.Models;
using LCU.API.Internal.RepoApi.Repos.Models.Producer;
using LCU.API.Internal.RepoApi.Repos.Models.Reporting;
using System.Data.Entity.Infrastructure;
using LCU.Library.Internal.RepoApiModels.Models;
namespace LCU.API.Internal.RepoApi.Repos.Persistence
{
public class AppDbContext : DbContext
{
public DbSet<AccountType> AccountTypeCodes { get; set; }
public DbSet<AllowedStatusChange> AllowedStatusChanges { get; set; }
public DbSet<AuctionHouse> Auctions { get; set; }
public DbSet<AuctionAssignment> AuctionAssignments { get; set; }
public DbSet<AuctionAssignmentNote> AuctionAssignmentNotes { get; set; }
public DbSet<AuditRecord> AuditRecords { get; set; }
public DbSet<BodyStyle> BodyStyleCodes { get; set; }
public DbSet<Borrower> Borrowers { get; set; }
public DbSet<CleaningLevel> CleaningLevelCodes { get; set; }
public DbSet<Collateral> Collaterals { get; set; }
public DbSet<CollateralType> CollateralTypes { get; set; }
public DbSet<CollateralTypeToVehicleType> CollateralTypesToVehicleTypes { get; set; }
public DbSet<EventAlert> EventAlerts { get; set; }
public DbSet<FloorPriceValuesUsed> FloorPriceValuesUsed { get; set; }
public DbSet<HoldStatus> HoldStatusCodes { get; set; }
public DbSet<ImsAutoFileData> ImsAutoFileData { get; set; }
public DbSet<Letter> Letters { get; set; }
public DbSet<LoanCategory> LoanCategories { get; set; }
public DbSet<LocationType> LocationTypeCodes { get; set; }
public DbSet<ProcessingReceipt> ProcessingReceipts { get; set; }
public DbSet<RepoAccount> RepoAccounts { get; set; }
public DbSet<RepoCompany> RepoCompanies { get; set; }
public DbSet<RepoManualStatus> RepoManualStatuses { get; set; }
public DbSet<RepoStatusChange> RepoStatusChanges { get; set; }
public DbSet<VehicleType> VehicleTypeCodes { get; set; }
public DbSet<VehicleFloorPricingParameters> VehicleFloorPricingParameters { get; set; }
public DbSet<RefundStatus> RefundStatuses { get; set; }
public DbSet<AuctionAssignmentToCollateral> AuctionAssignmentToCollaterals { get; set; }
public DbSet<RepoCompanySelection> RepoCompanySelections { get; set; }
public DbSet<SavedLocation> SavedLocations { get; set; }
public DbSet<ExternalUser> ExternalUsers { get; set; }
public DbSet<SixtyPlusCollector> SixtyPLusCollectors { get; set; }
public DbSet<RepoSyncRunInfo> RepoSyncRunInfo { get; set; }
public DbSet<RepoSyncBatch> RepoSyncBatch { get; set; }
// Queries for Reporting / etc
//TODO REMOVING FOR testing
//public DbQuery<StdReportEntry> StandardReportEntries { get; set; }
//public DbQuery<LandmarkReportAccountEntry> ActiveAccountEntries { get; set; }
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<EventAlert>().ToTable("EventAlert");
builder.Entity<EventAlert>().HasKey(p => p.Id);
builder.Entity<EventAlert>().Property(p => p.Id).IsRequired().ValueGeneratedOnAdd();
builder.Entity<EventAlert>().Property(p => p.AccountNo).IsRequired();
builder.Entity<EventAlert>().Property(p => p.DateAdded).IsRequired().ValueGeneratedOnAdd();
builder.Entity<EventAlert>().Property(p => p.CreatedBy).IsRequired().HasMaxLength(25);
builder.Entity<EventAlert>().Property(p => p.Message).IsRequired();
builder.Entity<EventAlert>().Property(p => p.EmailRecipient);
builder.Entity<EventAlert>().Property(p => p.EmailBody);
builder.Entity<Borrower>().ToTable("Borrowers");
builder.Entity<Borrower>().HasKey(p => new { p.RepoId, p.IndividualId });
builder.Entity<Borrower>().Property(p => p.IndividualName).IsRequired();
builder.Entity<Borrower>().Property(p => p.OwnershipType).IsRequired();
builder.Entity<ProcessingReceipt>().ToTable("ProcessingReceipt");
builder.Entity<ProcessingReceipt>().HasKey(p => new { p.AccountNo, p.AccountId, p.CaseId });
builder.Entity<ProcessingReceipt>().Property(p => p.AccountId);
builder.Entity<ProcessingReceipt>().Property(p => p.CaseId);
builder.Entity<ProcessingReceipt>().Property(p => p.QueuedBy);
builder.Entity<ProcessingReceipt>().Property(p => p.Message);
//TODO: DO this for repocompanyselection repo type
builder.Entity<ProcessingReceipt>().Property(p => p.Outcome)
.HasConversion(x => x.ToString(),
x => (RepoProcessingResult)Enum.Parse(typeof(RepoProcessingResult), x));
builder.Entity<ProcessingReceipt>().Property(p => p.Processed);
builder.Entity<RepoAccount>().ToTable("Repos");
builder.Entity<RepoAccount>().HasKey(p => p.RepoId);
builder.Entity<RepoAccount>().Property(p => p.RepoId).IsRequired().ValueGeneratedOnAdd();
builder.Entity<RepoAccount>().Property(p => p.AccountNo).IsRequired();
builder.Entity<RepoAccount>().Property(p => p.Status).IsRequired();
builder.Entity<RepoAccount>().Property(p => p.SubStatus);
builder.Entity<RepoAccount>().HasMany(p => p.Borrowers);
builder.Entity<RepoAccount>().HasMany(p => p.Collaterals);
builder.Entity<RepoAccount>().HasMany(p => p.RepoStatusChanges);
builder.Entity<RepoAccount>().HasOne(p => p.RefundStatus).WithOne().IsRequired(false);
builder.Entity<RepoAccount>().Property(p => p.RedemptionExpiredDate);
builder.Entity<RepoAccount>().HasOne(p => p.SixtyPlusCollector);
builder.Entity<RepoStatusChange>().ToTable("RepoStatusChanges");
builder.Entity<RepoStatusChange>().HasKey(p => new { p.RepoId, p.Id });
builder.Entity<RepoStatusChange>().Property(p => p.RepoId).IsRequired();
builder.Entity<RepoStatusChange>().Property(p => p.StatusFrom).IsRequired();
builder.Entity<RepoStatusChange>().Property(p => p.StatusTo).IsRequired();
builder.Entity<RepoStatusChange>().Property(p => p.ChangedBy).IsRequired();
builder.Entity<RepoStatusChange>().Property(p => p.ChangedDate).IsRequired().ValueGeneratedOnAdd();
builder.Entity<AuditRecord>().ToTable("AuditTable");
builder.Entity<AuditRecord>().HasKey(p => p.ID);
builder.Entity<AuditRecord>().Property(p => p.DatePerformed).IsRequired().ValueGeneratedOnAdd();
builder.Entity<AuditRecord>().Property(p => p.Description).IsRequired();
builder.Entity<AuditRecord>().Property(p => p.Action).IsRequired();
builder.Entity<AuditRecord>().Property(p => p.ClassName).IsRequired();
builder.Entity<AuditRecord>().Property(p => p.PerformedBy).IsRequired();
builder.Entity<AuditRecord>().Property(p => p.KeyRepresentation).IsRequired();
builder.Entity<AuditRecord>().Property(p => p.PropertyValues);
builder.Entity<Collateral>().ToTable("Collaterals");
builder.Entity<Collateral>().HasKey(p => p.CollateralId);
builder.Entity<Collateral>().Property(p => p.CollateralId).IsRequired().ValueGeneratedOnAdd();
builder.Entity<Collateral>().Property(p => p.RepoId).IsRequired();
builder.Entity<Collateral>().Property(p => p.Vin);
builder.Entity<Collateral>().Property(p => p.Make);
builder.Entity<Collateral>().Property(p => p.Model);
builder.Entity<Collateral>().Property(p => p.Year);
builder.Entity<Collateral>().Property(p => p.Description);
builder.Entity<Collateral>().Property(p => p.VehicleType);
builder.Entity<Collateral>().Property(p => p.BodyStyle);
builder.Entity<Collateral>().Property(p => p.Inoperable);
builder.Entity<Collateral>().Property(p => p.CollateralTypeId);
builder.Entity<Collateral>().Property(p => p.RetitledInLandmarkName);
builder.Entity<Collateral>().Property(p => p.RefCollateralId);
builder.Entity<Collateral>().HasMany(p => p.AuctionAssignmentToCollaterals);
builder.Entity<Collateral>().HasMany(p => p.RepoCompanySelections);
builder.Entity<RepoManualStatus>().ToTable("RepoManualStatus");
builder.Entity<RepoManualStatus>().HasKey(p => p.ID);
builder.Entity<RepoManualStatus>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<RepoManualStatus>().Property(p => p.Description).IsRequired();
builder.Entity<RepoManualStatus>().Property(p => p.IsActiveStatus).IsRequired();
builder.Entity<RepoManualStatus>().Property(p => p.WatchForStatusChanges).IsRequired();
builder.Entity<AccountType>().ToTable("AccountTypeCodes");
builder.Entity<AccountType>().HasKey(p => p.ID);
builder.Entity<AccountType>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<AccountType>().Property(p => p.Description).IsRequired();
builder.Entity<AccountType>().Property(p => p.IsVisible).IsRequired();
builder.Entity<AccountType>().Property(p => p.CategoryId);
builder.Entity<AllowedStatusChange>().ToTable("AllowedStatusChanges");
builder.Entity<AllowedStatusChange>().HasKey(p => p.ID);
builder.Entity<AllowedStatusChange>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<AllowedStatusChange>().Property(p => p.CurrentStatus).IsRequired();
builder.Entity<AllowedStatusChange>().Property(p => p.AllowedChangeStatus).IsRequired();
builder.Entity<BodyStyle>().ToTable("BodyStyleCodes");
builder.Entity<BodyStyle>().HasKey(p => p.Code);
builder.Entity<BodyStyle>().Property(p => p.Code).IsRequired();
builder.Entity<BodyStyle>().Property(p => p.Description).IsRequired();
builder.Entity<CleaningLevel>().ToTable("CleaningLevelCodes");
builder.Entity<CleaningLevel>().HasKey(p => p.Code);
builder.Entity<CleaningLevel>().Property(p => p.Code).IsRequired();
builder.Entity<CleaningLevel>().Property(p => p.Description).IsRequired();
builder.Entity<CollateralType>().ToTable("CollateralTypes");
builder.Entity<CollateralType>().HasKey(p => p.ID);
builder.Entity<CollateralType>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<CollateralType>().Property(p => p.Description).IsRequired();
builder.Entity<CollateralType>().Property(p => p.LookupHandler).IsRequired();
builder.Entity<HoldStatus>().ToTable("HoldStatusCodes");
builder.Entity<HoldStatus>().HasKey(p => p.Code);
builder.Entity<HoldStatus>().Property(p => p.Code).IsRequired();
builder.Entity<HoldStatus>().Property(p => p.Description).IsRequired();
builder.Entity<LoanCategory>().ToTable("LoanCategories");
builder.Entity<LoanCategory>().HasKey(p => p.ID);
builder.Entity<LoanCategory>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<LoanCategory>().Property(p => p.CategoryName).IsRequired();
builder.Entity<LocationType>().ToTable("LocationTypeCodes");
builder.Entity<LocationType>().HasKey(p => p.Code);
builder.Entity<LocationType>().Property(p => p.Code).IsRequired();
builder.Entity<LocationType>().Property(p => p.Description).IsRequired();
builder.Entity<VehicleType>().ToTable("VehicleTypeCodes");
builder.Entity<VehicleType>().HasKey(p => p.Code);
builder.Entity<VehicleType>().Property(p => p.Code).IsRequired();
builder.Entity<VehicleType>().Property(p => p.Description).IsRequired();
builder.Entity<CollateralTypeToVehicleType>().ToTable("CollateralTypesToVehicleTypes");
builder.Entity<CollateralTypeToVehicleType>().HasKey(p => p.ID);
builder.Entity<CollateralTypeToVehicleType>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<CollateralTypeToVehicleType>().Property(p => p.VehicleTypeId).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().ToTable("VehicleFloorPricingParameters");
builder.Entity<VehicleFloorPricingParameters>().HasKey(p => p.Id);
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.Id).IsRequired().ValueGeneratedOnAdd();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.LowCondition).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.HighCondition).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.NADAFirstValue).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.NADASecondValue).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.MMRAdjustedValue).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.PercentageOf).IsRequired();
builder.Entity<VehicleFloorPricingParameters>().Property(p => p.ValuationServiceType).IsRequired();
builder.Entity<Letter>().ToTable("Letters");
builder.Entity<Letter>().HasKey(p => p.ActionCode);
builder.Entity<Letter>().Property(p => p.Description).IsRequired();
builder.Entity<Letter>().Property(p => p.DaysToWait);
builder.Entity<Letter>().Property(p => p.WhenLetterIsSent);
builder.Entity<FloorPriceValuesUsed>().ToTable("FloorPriceValuesUsed");
builder.Entity<FloorPriceValuesUsed>().HasKey(p => new { p.AuctionAssignmentId, p.CollateralValuationId });
builder.Entity<FloorPriceValuesUsed>().Property(p => p.AuctionAssignmentId).IsRequired();
builder.Entity<FloorPriceValuesUsed>().Property(p => p.RepoId).IsRequired();
builder.Entity<FloorPriceValuesUsed>().Property(p => p.CollateralValuationId).IsRequired();
builder.Entity<FloorPriceValuesUsed>().Property(p => p.Condition);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.LowParam);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.HighParam);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.PercentageOf);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.AuctionGuideBookPrice);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.WasAuctionGuideBookPriceUsed);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.MMRNationalAdjustedPrice);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.MMRRegionalAdjustedPrice);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.WasMMRNationalAdjustedPriceUsed);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.WasMMRRegionalAdjustedPriceUsed);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.NADALowAdjustedAuctionValue);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.NADAAverageAdjustedAuctionValue);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.NADAHighAdjustedAuctionValue);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.WasNADALowAdjustedAuctionValueUsed);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.WasNADAAverageAdjustedAuctionValueUsed);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.WasNADAHighAdjustedAuctionValueUsed);
builder.Entity<FloorPriceValuesUsed>().Property(p => p.NADAMMRFloorPrice);
builder.Entity<FloorPriceValuesUsed>().HasOne(p => p.CollateralValuation);
// Only added code-referenced fields for below entities
builder.Entity<AuctionHouse>().ToTable("Auctions");
builder.Entity<AuctionHouse>().HasKey(p => p.AuctionID);
builder.Entity<AuctionHouse>().Property(p => p.AuctionID).IsRequired();
builder.Entity<AuctionHouse>().Property(p => p.Name);
builder.Entity<AuctionHouse>().Property(p => p.Active);
builder.Entity<AuctionHouse>().Property(p => p.Address_Line_1);
builder.Entity<AuctionHouse>().Property(p => p.Address_Line_2);
builder.Entity<AuctionHouse>().Property(p => p.City);
builder.Entity<AuctionHouse>().Property(p => p.Country);
builder.Entity<AuctionHouse>().Property(p => p.Fax);
builder.Entity<AuctionHouse>().Property(p => p.Latitude);
builder.Entity<AuctionHouse>().Property(p => p.Longitude);
builder.Entity<AuctionHouse>().Property(p => p.Phone);
builder.Entity<AuctionHouse>().Property(p => p.State);
builder.Entity<AuctionHouse>().Property(p => p.ZIP);
builder.Entity<AuctionAssignment>().ToTable("AuctionAssignments");
builder.Entity<AuctionAssignment>().HasKey(p => p.ID);
builder.Entity<AuctionAssignment>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<AuctionAssignment>().Property(p => p.AuctionId).IsRequired();
builder.Entity<AuctionAssignment>().Property(p => p.AuctionCustomerNo).IsRequired();
builder.Entity<AuctionAssignment>().Property(p => p.CollateralVIN);
builder.Entity<AuctionAssignment>().Property(p => p.DateSubmitted);
builder.Entity<AuctionAssignment>().Property(p => p.FloorPrice);
builder.Entity<AuctionAssignment>().Property(p => p.FloorPriceResponseCode);
builder.Entity<AuctionAssignment>().Property(p => p.FloorPriceResponseDescription);
builder.Entity<AuctionAssignment>().Property(p => p.FloorPriceSubmissionErrors);
builder.Entity<AuctionAssignment>().Property(p => p.HoldStatus);
builder.Entity<AuctionAssignment>().Property(p => p.HoldUntil);
builder.Entity<AuctionAssignment>().Property(p => p.RedeemedDate);
builder.Entity<AuctionAssignment>().Property(p => p.VehicleType);
builder.Entity<AuctionAssignment>().Property(p => p.BodyStyle);
builder.Entity<AuctionAssignment>().Property(p => p.Inoperable);
builder.Entity<AuctionAssignment>().Property(p => p.RetailValue);
builder.Entity<AuctionAssignment>().Property(p => p.AuctionNotes);
builder.Entity<AuctionAssignment>().Property(p => p.AvailablePickupDate);
builder.Entity<AuctionAssignment>().Property(p => p.LegalSaleDate);
builder.Entity<AuctionAssignment>().Property(p => p.CleaningLevel);
builder.Entity<AuctionAssignment>().Property(p => p.SubmissionErrors);
builder.Entity<AuctionAssignment>().Property(p => p.SubmissionResponseCode);
builder.Entity<AuctionAssignment>().Property(p => p.SubmissionResponseDescription);
builder.Entity<AuctionAssignment>().Property(p => p.SentTitleDocsDate);
builder.Entity<AuctionAssignment>().Property(p => p.TitleSentResponseCode);
builder.Entity<AuctionAssignment>().Property(p => p.TitleSentResponseDescription);
builder.Entity<AuctionAssignment>().Property(p => p.TitleSentSubmissionErrors);
builder.Entity<AuctionAssignment>().Property(p => p.AddedThroughRepoDatabase);
builder.Entity<AuctionAssignment>().Property(p => p.IsActive).HasDefaultValue(true);
builder.Entity<AuctionAssignment>().HasOne(p => p.AutoIMS);
builder.Entity<AuctionAssignment>().HasOne(p => p.Auction);
builder.Entity<AuctionAssignment>().HasMany(p => p.AuctionAssignmentToCollaterals);
builder.Entity<AuctionAssignment>().HasOne(p => p.FloorPriceValuesUsed);
builder.Entity<AuctionAssignmentNote>().ToTable("AuctionAssignmentNotes");
builder.Entity<AuctionAssignmentNote>().HasKey(p => p.Id);
builder.Entity<AuctionAssignmentNote>().Property(p => p.Id).IsRequired().ValueGeneratedOnAdd();
builder.Entity<AuctionAssignmentNote>().Property(p => p.AuctionAssignmentId).IsRequired();
builder.Entity<AuctionAssignmentNote>().Property(p => p.AuctionCustomerNo).IsRequired();
builder.Entity<AuctionAssignmentNote>().Property(p => p.DateWritten);
builder.Entity<AuctionAssignmentNote>().Property(p => p.Origin);
builder.Entity<AuctionAssignmentNote>().Property(p => p.Text);
builder.Entity<AuctionAssignmentNote>().Property(p => p.Type);
builder.Entity<ImsAutoFileData>().ToTable("ImsAutoFileData");
builder.Entity<ImsAutoFileData>().HasKey(p => new { p.VIN, p.RepoId });
builder.Entity<ImsAutoFileData>().Property(p => p.RepoId).IsRequired();
builder.Entity<ImsAutoFileData>().Property(p => p.AuctionCustomerNo).IsRequired();
builder.Entity<ImsAutoFileData>().Property(p => p.VIN).IsRequired();
builder.Entity<ImsAutoFileData>().Property(p => p.AssignmentAccepted);
builder.Entity<ImsAutoFileData>().Property(p => p.AuctionAssignmentId);
builder.Entity<ImsAutoFileData>().Property(p => p.DateReceivedFromAutoIMS);
builder.Entity<ImsAutoFileData>().Property(p => p.AnnouncedConditions);
builder.Entity<ImsAutoFileData>().Property(p => p.ApprovedVehicleGrade);
builder.Entity<ImsAutoFileData>().Property(p => p.ArbitrationReason);
builder.Entity<ImsAutoFileData>().Property(p => p.AsIs100KMiles);
builder.Entity<ImsAutoFileData>().Property(p => p.AuctionAge);
builder.Entity<ImsAutoFileData>().Property(p => p.AuctionGuideBookPrice);
builder.Entity<ImsAutoFileData>().Property(p => p.BuyerId);
builder.Entity<ImsAutoFileData>().Property(p => p.BuyerName);
builder.Entity<ImsAutoFileData>().Property(p => p.ChargeAmount);
builder.Entity<ImsAutoFileData>().Property(p => p.CheckAmount);
builder.Entity<ImsAutoFileData>().Property(p => p.ClientAge);
builder.Entity<ImsAutoFileData>().Property(p => p.ClientCancelled);
builder.Entity<ImsAutoFileData>().Property(p => p.CollateralImagePath);
builder.Entity<ImsAutoFileData>().Property(p => p.CollisionDamage);
builder.Entity<ImsAutoFileData>().Property(p => p.ConditionReportLink);
builder.Entity<ImsAutoFileData>().Property(p => p.DateEnteredAutoIMS);
builder.Entity<ImsAutoFileData>().Property(p => p.DatePickedUp);
builder.Entity<ImsAutoFileData>().Property(p => p.DateofLoss);
builder.Entity<ImsAutoFileData>().Property(p => p.DaysRun);
builder.Entity<ImsAutoFileData>().Property(p => p.DaysRunHighestBidRecordedbyAuction);
builder.Entity<ImsAutoFileData>().Property(p => p.DaystoDelivery);
builder.Entity<ImsAutoFileData>().Property(p => p.Description);
builder.Entity<ImsAutoFileData>().Property(p => p.FloorPriceAccepted);
builder.Entity<ImsAutoFileData>().Property(p => p.FundsSent);
builder.Entity<ImsAutoFileData>().Property(p => p.GrossPercentFloor);
builder.Entity<ImsAutoFileData>().Property(p => p.HighestBid);
builder.Entity<ImsAutoFileData>().Property(p => p.InspectedDate);
builder.Entity<ImsAutoFileData>().Property(p => p.IsDrivable);
builder.Entity<ImsAutoFileData>().Property(p => p.IsOperable);
builder.Entity<ImsAutoFileData>().Property(p => p.MMR);
builder.Entity<ImsAutoFileData>().Property(p => p.MMRNationalAdjustedPrice);
builder.Entity<ImsAutoFileData>().Property(p => p.MMRRegionalAdjustedPrice);
builder.Entity<ImsAutoFileData>().Property(p => p.NetPercentFloor);
builder.Entity<ImsAutoFileData>().Property(p => p.OTHERAdvancedOther);
builder.Entity<ImsAutoFileData>().Property(p => p.OTHERAdvancedStorage);
builder.Entity<ImsAutoFileData>().Property(p => p.OTHERAdvancedTow);
builder.Entity<ImsAutoFileData>().Property(p => p.OTHERMiscellaneous);
builder.Entity<ImsAutoFileData>().Property(p => p.OTHERTotal);
builder.Entity<ImsAutoFileData>().Property(p => p.OtherAdvanceFees);
builder.Entity<ImsAutoFileData>().Property(p => p.ScheduledSaleDate);
builder.Entity<ImsAutoFileData>().Property(p => p.SoldDate);
builder.Entity<ImsAutoFileData>().Property(p => p.Status);
builder.Entity<ImsAutoFileData>().Property(p => p.SalePrice);
builder.Entity<ImsAutoFileData>().Property(p => p.ShipmentDate);
builder.Entity<ImsAutoFileData>().Property(p => p.StorageCost);
builder.Entity<ImsAutoFileData>().Property(p => p.StorageRatePerDay);
builder.Entity<ImsAutoFileData>().Property(p => p.StatedMileage);
builder.Entity<ImsAutoFileData>().Property(p => p.TitleNumber);
builder.Entity<ImsAutoFileData>().Property(p => p.TitleReceived);
builder.Entity<ImsAutoFileData>().Property(p => p.TitleReturned);
builder.Entity<ImsAutoFileData>().Property(p => p.TitleState);
builder.Entity<ImsAutoFileData>().Property(p => p.TitleStatus);
builder.Entity<ImsAutoFileData>().Property(p => p.TitleStatusfromAuction);
builder.Entity<ImsAutoFileData>().Property(p => p.TotalCharges);
builder.Entity<ImsAutoFileData>().Property(p => p.TowCost);
builder.Entity<ImsAutoFileData>().Property(p => p.VehicleDecimalGradeCode);
builder.Entity<ImsAutoFileData>().Property(p => p.VehicleGrade);
builder.Entity<RepoCompany>().ToTable("RepoCompany");
builder.Entity<RepoCompany>().HasKey(p => p.ID);
builder.Entity<RepoCompany>().Property(p => p.ID).IsRequired().ValueGeneratedOnAdd();
builder.Entity<RepoCompany>().Property(p => p.Name);
builder.Entity<RepoCompany>().Property(p => p.Email);
builder.Entity<RefundStatus>().ToTable("RefundStatuses");
builder.Entity<RefundStatus>().HasKey(p => p.RepoId);
builder.Entity<AuctionAssignmentToCollateral>().ToTable("AuctionAssignmentsToCollaterals");
builder.Entity<AuctionAssignmentToCollateral>().HasKey(p => new { p.AuctionAssignmentId, p.CollateralId });
builder.Entity<AuctionAssignmentToCollateral>()
.HasOne(aa2c => aa2c.AuctionAssignment)
.WithMany(auctionAssignment => auctionAssignment.AuctionAssignmentToCollaterals)
.HasForeignKey(aa2c => aa2c.AuctionAssignmentId);
builder.Entity<AuctionAssignmentToCollateral>()
.HasOne(aa2c => aa2c.Collateral)
.WithMany(Collateral => Collateral.AuctionAssignmentToCollaterals)
.HasForeignKey(aa2c => aa2c.CollateralId);
builder.Entity<RepoCompanySelection>().ToTable("RepoCompanySelections");
builder.Entity<RepoCompanySelection>().HasKey(p => p.Id);
builder.Entity<RepoCompanySelection>().Property(p => p.RepoType)
.HasConversion(x => x.ToString(),
x => (RepoType)Enum.Parse(typeof(RepoType), x));
builder.Entity<ProcessingReceipt>().Property(p => p.Processed);
builder.Entity<SavedLocation>().ToTable("SavedLocations");
builder.Entity<SavedLocation>().HasKey(p => p.ID);
builder.Entity<ExternalUser>().ToTable("UserCache");
builder.Entity<ExternalUser>().HasKey(p => p.Id);
builder.Entity<ExternalUser>().Property(p => p.Name);
builder.Entity<ExternalUser>().Property(p => p.Code);
builder.Entity<SixtyPlusCollector>().ToTable("SixtyPlusCollector");
builder.Entity<SixtyPlusCollector>().HasKey(p => p.SixtyPlusCollectorId);
}
}
}