using Code.Domain;
using Code.Utils;

namespace Code.InterfaceAdapters.Profile
{
    public class ProfilePresenter
    {
        private readonly ProfileViewModel _model;

        public ProfilePresenter(ProfileViewModel model)
        {
            _model = model;
            
            EventDispatcherService.Instance.Subscribe<UserData>(OnUserDateUpdated);
        }
        
        private void OnUserDateUpdated(UserData data)
        {
            _model.UserName.Value = data.Name;
        }
    }
}