using System.Collections.Generic; using HighRollerClassic.DataStructures; namespace HighRollerClassic.SettingsStructure; public class Settings(Configuration? configuration) { /// /// Whether developer options should be visible in the settings /// public bool devOptions = false; /// /// Maximum bet that will be allowed to set /// public TrackedValue MaxBet { get; set; } = new(SettingValueType.MaxBet, null); /// /// How much the bet will change when user adjusts their bet via +/- keys /// public uint? Step { get; set; } /// /// Contains messages such as announcements etc. /// public List Macros { get; private set; } = new(); // todo we'll make this a new class because we have 3 roll methods already 'polluting' this class public readonly RollsCollection RollsCollection = new(); // todo might get fucky wucky if maxbet is not yet defined public bool IsValid => MaxBet.IsValid && StepValid() && RollsCollection.ValidateAll(); public bool Set => IsValid && RollsCollection.Size > 0 && Macros.Count > 0; private bool StepValid() { uint maxBet; if (configuration is { Settings.MaxBet.IsValid: true }) { maxBet = configuration.Settings.MaxBet.Value!.Value; //IsValid guarantees validity } else if (MaxBet.IsValid) { maxBet = MaxBet.Value!.Value; // IsValid } else { maxBet = 0; } return Step <= maxBet; } }