using System;
using Tornado3_2026Election.Common;

namespace Tornado3_2026Election.ViewModels;

public sealed class RegionOptionViewModel : ObservableObject
{
    private readonly Action _selectionChanged;
    private bool _isSelected;

    public RegionOptionViewModel(string name, bool isSelected, Action selectionChanged)
    {
        Name = name;
        _isSelected = isSelected;
        _selectionChanged = selectionChanged;
    }

    public string Name { get; }

    public bool IsSelected
    {
        get => _isSelected;
        set
        {
            if (SetProperty(ref _isSelected, value))
            {
                _selectionChanged();
            }
        }
    }
}
