using TMPro;
using UnityEngine;

public class DayEndHUDController : MonoBehaviour {
    [SerializeField] private TextMeshProUGUI _gainsText;

    [SerializeField] private TextMeshProUGUI _rentText;
    [SerializeField] private TextMeshProUGUI _profitText;

    [SerializeField] private TextMeshProUGUI _buttonText;

    public void DayEnd(float gains, float rent, float profit) {
        _gainsText.text = "Gains: " + gains + "$";
        _rentText.text = "Rent: " + rent + "$";
        _profitText.text = "Profit: " + profit + "$";

        //Check if the user is bankrupt
        if (GameController.Instance.Money < 0) {
            _buttonText.text = "Game Over";
        }
        else {
            _buttonText.text = "Next Day";
        }
    }

    public void ConfirmEnd() {
        GameController.Instance.Reset();
        if (GameController.Instance.Money < 0) {
            GameController.GameOver(GameController.LooseCondition.Bankrupt);
        }
    }
}