using System.Text.Json.Serialization;
namespace Ghost.Editor.Core.SceneGraph.Serialization;
///
/// JSON-serializable representation of a component instance.
/// Only used in the editor for saving/loading scenes.
///
[Serializable]
public class ComponentData
{
///
/// Fully qualified type name of the component (e.g., "Ghost.Engine.Components.Transform").
///
[JsonPropertyName("type")]
public string ComponentTypeName { get; set; } = string.Empty;
///
/// Serialized component data as a dictionary.
/// Field names map to JSON values.
///
[JsonPropertyName("data")]
public Dictionary Data { get; set; } = new();
}
///
/// JSON-serializable representation of an entity within a scene.
/// Only used in the editor for saving/loading scenes.
///
/// The index in the entities list corresponds to the file-local ID.
///
[Serializable]
public class EntityData
{
///
/// File-local entity ID within the scene.
/// Set by the serializer based on position in the entities list.
///
[JsonPropertyName("fileLocalId")]
public int FileLocalId { get; set; }
///
/// Editor-only name for the entity.
///
[JsonPropertyName("name")]
public string Name { get; set; } = "Entity";
///
/// File-local ID of the parent entity, or -1 if root.
///
[JsonPropertyName("parentFileLocalId")]
public int ParentFileLocalId { get; set; } = -1;
///
/// All components attached to this entity.
///
[JsonPropertyName("components")]
public List Components { get; set; } = new();
}
///
/// JSON-serializable representation of a scene.
/// Only used in the editor for saving/loading scenes.
///
[Serializable]
public class SceneAssetData
{
///
/// Scene metadata version for forward compatibility.
///
[JsonPropertyName("version")]
public int Version { get; set; } = 1;
///
/// Unique identifier for this scene (GUID).
///
[JsonPropertyName("sceneGuid")]
public Guid SceneGuid { get; set; } = Guid.NewGuid();
///
/// Editor-friendly name of the scene.
///
[JsonPropertyName("name")]
public string Name { get; set; } = "Scene";
///
/// Runtime scene ID.
///
[JsonPropertyName("sceneId")]
public short SceneId { get; set; }
///
/// All entities in the scene, ordered by file-local ID.
/// Index in this list == file-local ID.
///
[JsonPropertyName("entities")]
public List Entities { get; set; } = new();
}