/*
<copyright file="BGDBUiToolkitGoEditor.cs" company="BansheeGz">
    Copyright (c) 2018-2021 All Rights Reserved
</copyright>
*/

using UnityEditor;
using UnityEngine;

namespace BansheeGz.BGDatabase.Editor
{
    [CustomEditor(typeof(BGDataBinderUiToolkitGo))]
    public class BGDBUiToolkitGoEditor : BGEditorDataBinderGoA
    {
        private BGDataBinderUiToolkitGo toolkit;

        public BGDataBinderUiToolkitGo Toolkit => toolkit;

        protected override void OnEnableInternal() => toolkit = (BGDataBinderUiToolkitGo)target;

        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            BGEditorUtility.UniformStyle(() =>
            {
                SourceMethod(false);
                BGEditorUtility.Horizontal(() =>
                {
                    GUILayout.Label("Binders", BGStyle.Editor_label);
                    if (!GUILayout.Button("Edit [" + toolkit.BindersCount + "] binders", BGStyle.Button)) return;
                    BGDBUiToolkitBindersWindow.Open(toolkit);
                });
                BGEditorUtility.TabPanel("UI Builder integration", () => BGDBUiToolkitBuilderIntegration.OnGUI(this));
                
            });
        }
    }
}