namespace LaaProductionWeb.Blazor.Components.HeliumTester.Models { using LaaPackages.Data.HeliumTester; using System; using System.Runtime.CompilerServices; public class WaterRecipeModel(WaterRecipe entity = default) { private readonly WaterRecipe entity = entity ?? new WaterRecipe(); public event Action PropertyChanged; public event Action RecipeChanged; public virtual int Id => this.entity.Id; public virtual string MatchRegion => this.entity.MatchRegion; public virtual string MatchMeterSize => this.entity.MatchMeterSize; public virtual string MatchBodyLength => this.entity.MatchBodyLength; public virtual string MatchPressureSensor => this.entity.MatchPressureSensor; public virtual int RunTest { get => this.entity.RunTest; set { this.entity.RunTest = value; this.NotifyPropertyChanged(); } } public virtual int FlushTime { get => this.entity.FlushTime; set { this.entity.FlushTime = value; this.NotifyPropertyChanged(); } } public virtual int TargetPressure { get => this.entity.TargetPressure; set { this.entity.TargetPressure = value; this.NotifyPropertyChanged(); } } public virtual int LowerLimitPressure { get => this.entity.LowerLimitPressure; set { this.entity.LowerLimitPressure = value; this.NotifyPropertyChanged(); } } public virtual int UpperLimitPressure { get => this.entity.UpperLimitPressure; set { this.entity.UpperLimitPressure = value; this.NotifyPropertyChanged(); } } public virtual int StabilizationTime { get => this.entity.StabilizationTime; set { this.entity.StabilizationTime = value; this.NotifyPropertyChanged(); } } public virtual int TestTime { get => this.entity.TestTime; set { this.entity.TestTime = value; this.NotifyPropertyChanged(); } } public virtual double LowerLimitPressureDrop { get => this.entity.LowerLimitPressureDrop; set { this.entity.LowerLimitPressureDrop = value; this.NotifyPropertyChanged(); } } public virtual double UpperLimitPressureDrop { get => this.entity.UpperLimitPressureDrop; set { this.entity.UpperLimitPressureDrop = value; this.NotifyPropertyChanged(); } } private void NotifyPropertyChanged([CallerMemberName] string member = default) { this.PropertyChanged?.Invoke(member); this.RecipeChanged?.Invoke(this); } public static WaterRecipe ToEntity(WaterRecipeModel model) => model.entity; public static WaterRecipeModel ToModel(WaterRecipe entity) => new(entity); } }