using System;
using System.Text;
using RebootKit.Engine.Foundation;
using UnityEngine;
using UnityEngine.UIElements;

namespace RebootKit.Engine.Development {
    public class GameVersionOverlay : MonoBehaviour {
        const string k_VersionLabelName = "rr-dev__version_label";

        [SerializeField] UIDocument m_Document;

        void OnEnable() {
            Label versionLabel = m_Document.rootVisualElement.Q<Label>(k_VersionLabelName);
            versionLabel.text = BuildLabel();
        }

        string BuildLabel() {
            StringBuilder sb = new StringBuilder();
            sb.Append("ver. ");
            sb.Append(Application.version);

#if RR_DEBUG
            sb.Append(" (RR_DEBUG)");
#endif
            
#if RR_STEAM
            sb.Append(" (RR_STEAM)");
#endif

            return sb.ToString();
        }
    }
}