using Cryville.Common.Unity.UI;
using Cryville.EEW.Report;
using UnityEngine;

namespace Cryville.EEW.Unity.UI {
	class EventPropertyView : MonoBehaviour {
		[SerializeField] TMPLocalizedText m_text;

		public void Set(Localized<ReportViewModelProperty> prop) {
			var culture = prop.Culture;
			var p = prop.Value;
			var s = string.IsNullOrWhiteSpace(p.Key) ? p.Value : string.Format(culture, "{0} {1}", p.Key, p.Value);
			if (!string.IsNullOrWhiteSpace(p.Condition)) s = string.Format(culture, "{0} {1}", s, p.Condition);
			m_text.SetText(s, culture);
		}
	}
}
