using UnityEditor;

namespace IntelligentProjectAnalyzer.Editor.Graphing
{
    public class AssetNodeResolver
    {
        public static GraphNode CreateNodeFromGuid(string guid)
        {
            var path = AssetDatabase.GUIDToAssetPath(guid);
            if (string.IsNullOrEmpty(path))
            {
                return new GraphNode { Guid = guid, Path = "N/A (Missing Asset)", Type = "Unknown" };
            }

            var assetType = AssetDatabase.GetMainAssetTypeAtPath(path);
            return new GraphNode
            {
                Guid = guid,
                Path = path,
                Type = assetType?.Name ?? "Unknown"
            };
        }
    }
}