44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System;
|
|
using LCU.Shared.Collections.RepoApiLib.Models;
|
|
|
|
namespace LCU.API.Collections.RepoApi.Domain.FloorPricing.Strategies
|
|
{
|
|
/**
|
|
* This strategy uses the suggested price from the ImsAutoFileData entry for the auction.
|
|
*/
|
|
public class AutoImsSuggestedValue : IFloorPricingStrategy
|
|
{
|
|
public AutoImsSuggestedValue() { }
|
|
|
|
public FloorPriceCalculationResult CalculateFloorPrice(FloorPriceCalculationParams fpcParams)
|
|
{
|
|
var result = new FloorPriceCalculationResult()
|
|
{
|
|
StrategyName = this.GetType().FullName,
|
|
Success = false
|
|
};
|
|
|
|
if (fpcParams?.ImsAutoFileData?.AuctionGuideBookPrice != null)
|
|
{
|
|
// Price must be rounded to nearest $5 per business.
|
|
var inputPrice = (double)(fpcParams.ImsAutoFileData.AuctionGuideBookPrice ?? 0);
|
|
result.FloorPrice = (decimal) (Math.Round( inputPrice / 5.0) * 5);
|
|
result.Success = result.FloorPrice > 0;
|
|
result.FailureReason = result.Success ? "" : "Failed attempt to use auction guide book price.";
|
|
}
|
|
else
|
|
{
|
|
result.Success = false;
|
|
result.FailureReason = "Auction Guide Book Price missing.";
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public int GetStrategyWeight()
|
|
{
|
|
return 0; // This is NOT the preferred strategy.
|
|
}
|
|
}
|
|
}
|