using Code.InterfaceAdapters.MainMenu;
using UniRx;
using UnityEngine;
using UnityEngine.UI;

namespace Code.View
{
    public class MainMenuView : ViewBase
    {
        [SerializeField] private Button _loginButton;

        private MainMenuViewModel _model;

        public void Configure(MainMenuViewModel model)
        {
            _model = model;

            _model
                .IsVisible
                .Subscribe(isVisible => gameObject.SetActive(isVisible))
                .AddTo(_disposables);

            _loginButton
                .onClick
                .AddListener(() => { _model.LoginButtonPressed.Execute(); });
        }
    }
}