using UnityEditor;

namespace Davanci.Nexus.Editor
{
    // Opens the Nexus Setup window once, the first time the package is imported.
    [InitializeOnLoad]
    public static class NexusAutoOpen
    {
        const string ShownKeyPrefix = "DavanciNexus.SetupShown.";

        static NexusAutoOpen() => EditorApplication.delayCall += TryOpen;

        static void TryOpen()
        {
            string key = ShownKeyPrefix + PlayerSettings.productGUID;
            if (EditorPrefs.GetBool(key, false))
                return;

            EditorPrefs.SetBool(key, true);
            NexusSetupWindow.Open();
        }
    }
}
