2025-07-10 18:40:38 -04:00
|
|
|
class Valuation::Name
|
|
|
|
def initialize(valuation_kind, accountable_type)
|
|
|
|
@valuation_kind = valuation_kind
|
|
|
|
@accountable_type = accountable_type
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
case valuation_kind
|
|
|
|
when "opening_anchor"
|
|
|
|
opening_anchor_name
|
|
|
|
when "current_anchor"
|
|
|
|
current_anchor_name
|
|
|
|
else
|
|
|
|
recon_name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
attr_reader :valuation_kind, :accountable_type
|
|
|
|
|
|
|
|
def opening_anchor_name
|
|
|
|
case accountable_type
|
2025-07-15 11:42:41 -04:00
|
|
|
when "Property", "Vehicle"
|
2025-07-10 18:40:38 -04:00
|
|
|
"Original purchase price"
|
|
|
|
when "Loan"
|
|
|
|
"Original principal"
|
2025-07-15 11:42:41 -04:00
|
|
|
when "Investment", "Crypto", "OtherAsset"
|
2025-07-10 18:40:38 -04:00
|
|
|
"Opening account value"
|
|
|
|
else
|
|
|
|
"Opening balance"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_anchor_name
|
|
|
|
case accountable_type
|
2025-07-15 11:42:41 -04:00
|
|
|
when "Property", "Vehicle"
|
2025-07-10 18:40:38 -04:00
|
|
|
"Current market value"
|
|
|
|
when "Loan"
|
|
|
|
"Current loan balance"
|
2025-07-15 11:42:41 -04:00
|
|
|
when "Investment", "Crypto", "OtherAsset"
|
2025-07-10 18:40:38 -04:00
|
|
|
"Current account value"
|
|
|
|
else
|
|
|
|
"Current balance"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def recon_name
|
|
|
|
case accountable_type
|
2025-07-15 11:42:41 -04:00
|
|
|
when "Property", "Investment", "Vehicle", "Crypto", "OtherAsset"
|
2025-07-10 18:40:38 -04:00
|
|
|
"Manual value update"
|
|
|
|
when "Loan"
|
|
|
|
"Manual principal update"
|
|
|
|
else
|
|
|
|
"Manual balance update"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|