using Cryville.EEW.Core;
using UnityEngine;
using UnityEngine.UI;

namespace Cryville.EEW.Unity.UI {
	class EventUnitView : EventReportView {
		[SerializeField] EventListView m_listView;

		[SerializeField] Button m_revisionViewContainerButton;

		protected override void Start() {
			base.Start();
			m_revisionViewContainerButton.onClick.AddListener(OnRevisionViewClicked);
		}
		void OnRevisionViewClicked() {
			m_listView.gameObject.SetActive(!m_listView.gameObject.activeSelf);
		}

		public void Set(ReportUnit unit) {
			lock (unit) {
				SetViewModel(unit.LatestReport, unit.Count <= 1);
				m_listView.Set(unit);
			}
			m_listView.gameObject.SetActive(false);
		}
	}
}
