mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 07:13:12 +00:00
20 lines
640 B
C#
20 lines
640 B
C#
|
|
using Data.SeaHavenIndustries.Enums;
|
||
|
|
|
||
|
|
namespace SeaHaven.Services.Helpers
|
||
|
|
{
|
||
|
|
public static class WorkOrderUpliftAllowance
|
||
|
|
{
|
||
|
|
public const decimal StandardCapUsd = 500m;
|
||
|
|
public const decimal EmergencyCapUsd = 5000m;
|
||
|
|
|
||
|
|
public static decimal CapFor(WorkOrderType? type) =>
|
||
|
|
type == WorkOrderType.Emergency ? EmergencyCapUsd : StandardCapUsd;
|
||
|
|
|
||
|
|
public static decimal Remaining(decimal cap, decimal consumedAutoApproved) =>
|
||
|
|
Math.Max(0m, cap - consumedAutoApproved);
|
||
|
|
|
||
|
|
public static bool AutoApproves(decimal amount, decimal remaining) =>
|
||
|
|
amount <= remaining;
|
||
|
|
}
|
||
|
|
}
|