using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Unity.Pipeline.Editor.Commands.Scenes
{
///
/// Serializable snapshot of an open scene's GameObject tree, returned by
/// get_scene_hierarchy.
///
/// WHY a dedicated tree type (rather than reusing ):
/// the hierarchy is meant to be the *input* to GameObject-targeting commands. Every node carries
/// a stable and a ,
/// either of which is directly accepted by
/// / .
/// That lets an agent fetch the tree once and then address any node without a second round-trip.
/// The shape is kept intentionally small and JSON-friendly (no UnityEngine references) so it
/// survives the HTTP boundary cleanly.
///
[Serializable]
public class SceneHierarchy
{
/// Scene name (the file name without extension for a saved scene).
[JsonProperty("sceneName")]
public string SceneName { get; set; }
/// Project-relative scene asset path, or empty for an unsaved scene.
[JsonProperty("scenePath")]
public string ScenePath { get; set; }
/// Whether this scene currently has unsaved changes.
[JsonProperty("isDirty")]
public bool IsDirty { get; set; }
/// Whether this scene is the active scene.
[JsonProperty("isActive")]
public bool IsActive { get; set; }
/// Root GameObjects of the scene, each with their descendants.
[JsonProperty("roots")]
public List Roots { get; set; } = new List();
}
///
/// One GameObject node in a , with enough identity to be used as an
/// handle (instanceId or hierarchyPath) by
/// follow-up GameObject commands.
///
[Serializable]
public class SceneHierarchyNode
{
/// GameObject name.
[JsonProperty("name")]
public string Name { get; set; }
///
/// Runtime instance id of the GameObject. Stable for the lifetime of the loaded scene and
/// directly usable as ObjectRef.instanceId.
///
[JsonProperty("instanceId")]
public ObjectId InstanceId { get; set; }
///
/// Slash-delimited scene path (e.g. "/Root/Child/Leaf"), directly usable as
/// ObjectRef.hierarchyPath.
///
[JsonProperty("hierarchyPath")]
public string HierarchyPath { get; set; }
/// Whether the GameObject is active in the hierarchy.
[JsonProperty("activeSelf")]
public bool ActiveSelf { get; set; }
/// Component type names attached to this GameObject (e.g. "Transform", "Camera").
[JsonProperty("components")]
public List Components { get; set; } = new List();
/// Child nodes.
[JsonProperty("children")]
public List Children { get; set; } = new List();
}
}