using JdeScoping.ConfigManager.Models; namespace JdeScoping.ConfigManager.ViewModels.Forms; /// /// ViewModel for editing Auth configuration section. /// public class AuthFormViewModel : ViewModelBase { private readonly AuthSection _model; private readonly Action _onChanged; /// /// Initializes a new instance of the class. /// /// The auth section model to edit. /// The callback to invoke when configuration changes. public AuthFormViewModel(AuthSection model, Action onChanged) { _model = model ?? throw new ArgumentNullException(nameof(model)); _onChanged = onChanged ?? throw new ArgumentNullException(nameof(onChanged)); } /// /// Gets or sets the name of the authentication cookie. /// public string CookieName { get => _model.CookieName; set { if (_model.CookieName != value) { _model.CookieName = value; OnPropertyChanged(); _onChanged(); } } } /// /// Gets or sets the cookie expiration time in minutes. /// public int CookieExpirationMinutes { get => _model.CookieExpirationMinutes; set { if (_model.CookieExpirationMinutes != value) { _model.CookieExpirationMinutes = value; OnPropertyChanged(); _onChanged(); } } } }