using System;

namespace QuizPleaseTest.Common.UI
{
    public class UIView<TVm> : UIView where TVm : IUIViewModel
    {
        public TVm ViewModel { get; private set; }

        public virtual void Bind(TVm viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            ViewModel = viewModel;
        }

        public override void Release()
        {
            base.Release();
            ViewModel = default;
        }
    }
}
