using System.ComponentModel;
using ClaudeDo.Localization;

namespace ClaudeDo.Ui.Localization;

public sealed class LocalizedString : INotifyPropertyChanged
{
    private readonly ILocalizer _localizer;
    private readonly string _key;

    public LocalizedString(ILocalizer localizer, string key)
    {
        _localizer = localizer;
        _key = key;
        _localizer.LanguageChanged += (_, _) =>
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value)));
    }

    public string Value => _localizer[_key];

    public event PropertyChangedEventHandler? PropertyChanged;
}
