using System;

namespace XGame.Framework.UI
{
    public sealed class UIKey
    {
        public string Key { get; private set; }
        /// <summary>
        /// UIView的类型
        /// </summary>
        public Type UIViewType { get; private set; }
        /// <summary>
        /// FGUI的包名
        /// </summary>
        public string PackageName {  get; private set; }
        /// <summary>
        /// FGUI的UI名字
        /// </summary>
        public string PanelName {  get; private set; }
        public UIKey(string key, Type viewType)
        {
            Key = key;
            UIViewType = viewType;
        }
        public UIKey(string packageName, string panelName, Type viewType) 
        {
            Key = $"{packageName}_{panelName}";
            UIViewType = viewType;
            PackageName = packageName ;
            PanelName = panelName ;
        }

        public static implicit operator string(UIKey uiKey) => uiKey.Key;
        public override string ToString() => Key;
    }
}
