using EonaCat.FirstLight.SaveTransfer.VdfGenerator.KeyValue.Interfaces;
namespace EonaCat.FirstLight.SaveTransfer.VdfGenerator.KeyValue.Models;
///
/// Represents a hierarchical group of key-value nodes, allowing organization of nested key-value pairs and groups.
///
/// The key that identifies this group. Cannot be null.
public class KeyValueGroup(string key) : IKeyValueNode
{
public string Key { get; } = key;
public List Nodes { get; } = [];
///
/// Adds a new key-value pair to the group.
///
/// The key to associate with the value. Cannot be null.
/// The value to associate with the key. Cannot be null.
/// The current instance with the new key-value pair added.
public KeyValueGroup Add(string key, string value)
{
Nodes.Add(new KeyValuePair(key, value));
return this;
}
///
/// Adds the specified group to the collection of nodes.
///
/// The group to add to the collection. Cannot be null.
/// The current instance with the added group, enabling method chaining.
public KeyValueGroup Add(KeyValueGroup group)
{
Nodes.Add(group);
return this;
}
}