using System.Text.Json.Serialization; namespace FinlyticCore.Dtos.Yahoo; /// /// Represents a Yahoo Finance value wrapper containing raw numerical data alongside formatted strings. /// public record YahooValueDto { [JsonPropertyName("raw")] public double? Raw { get; init; } [JsonPropertyName("fmt")] public string? Fmt { get; init; } [JsonPropertyName("longFmt")] public string? LongFmt { get; init; } /// /// Helper property to retrieve Raw as double (or fallback 0.0). /// [JsonIgnore] public double DoubleValue => Raw ?? 0.0; /// /// Helper property to retrieve Raw as decimal (or fallback 0m). /// [JsonIgnore] public decimal DecimalValue => Raw.HasValue ? (decimal)Raw.Value : 0m; /// /// Helper property to retrieve Raw as long (or fallback 0L). /// [JsonIgnore] public long LongValue => Raw.HasValue ? (long)Raw.Value : 0L; }