using Cryville.EEW.Report;
using System.Collections.Generic;
using UnityEngine;

namespace Cryville.EEW.Unity.UI {
	class EventPropertyListView : MonoBehaviour {
		[SerializeField]
		EventPropertyView m_prefabEventPropertyView;

		public void Set(IEnumerable<Localized<ReportViewModelProperty>> props) {
			foreach (Transform child in transform) {
				Destroy(child.gameObject);
			}
			foreach (var prop in props) {
				Add(prop);
			}
		}
		void Add(Localized<ReportViewModelProperty> prop) {
			var child = Instantiate(m_prefabEventPropertyView);
			child.Set(prop);
			child.transform.SetParent(transform, false);
		}
	}
}
