using TMPro;
using UnityEngine;

namespace eagle {
    public class MovingArmyTableRow : TableRowController {
        public GameObject factionRow;
        public TMP_Text factionLabel;
        public GameObject heroesTroopsRow;
        public TMP_Text heroCountLabel;
        public TMP_Text troopCountLabel;
        public GameObject suppliesRow;
        public TMP_Text foodLabel;
        public TMP_Text goldLabel;
        public TMP_Text originLabel;
        public TMP_Text destinationLabel;

        public string Faction {
            set {
                factionLabel.text = value;
                factionRow.SetActive(!string.IsNullOrEmpty(value));
            }
        }

        public Color FactionColor { set => factionLabel.color = value; }

        private int _heroCount;
        public int HeroCount {
            set {
                _heroCount = value;
                heroCountLabel.text = _heroCount.ToString();
                heroesTroopsRow.SetActive(_heroCount != 0 || _troopCount != 0);
            }
        }

        private int _troopCount;
        public int TroopCount {
            set {
                _troopCount = value;
                troopCountLabel.text = value.ToString();
                heroesTroopsRow.SetActive(_heroCount != 0 || _troopCount != 0);
            }
        }

        private int _food = 0;
        public int Food {
            set {
                _food = value;
                foodLabel.text = _food.ToString();
                suppliesRow.SetActive(_food != 0 || _gold != 0);
            }
        }

        private int _gold = 0;
        public int Gold {
            set {
                _gold = value;
                goldLabel.text = _gold.ToString();
                suppliesRow.SetActive(_food != 0 || _gold != 0);
            }
        }

        public string Origin { set => originLabel.text = value; }

        public string Destination { set => destinationLabel.text = value; }

        public Color DestinationColor { set => destinationLabel.color = value; }
    }
}