using Net.Eagle0.Eagle.Views;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace eagle {
    public class BattalionRowController : TableRowController {
        public RawImage battalionImage;
        public TMP_Text sizeLabel;
        public TMP_Text trainingLabel;
        public TMP_Text armamentLabel;
        public TMP_Text battalionNameLabel;

        public BattalionView Battalion {
            set {
                battalionImage.texture =
                        gameObject.GetComponentInParent<EagleCommonTextures>().BattalionType(
                                value.Type);
                if (battalionImage.texture == null) { battalionImage.color = Color.clear; }
                sizeLabel.text = value.Size.ToString();
                trainingLabel.text =
                        value.Training is double training ? ((int)training).ToString() : "?";
                armamentLabel.text =
                        value.Armament is double armament ? ((int)armament).ToString() : "?";
                battalionNameLabel.text = value.Name;
            }
        }
    }
}