using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace HeuristicLab.JsonInterface { [JsonObject] public interface IJsonItem : IEnumerable { /// /// Only active items are included in templates. /// bool Active { get; set; } /// /// The name of the JsonItem. Can be changed freely after fixating the path. /// If the path is not fix, changing the name will have affect of the path. /// string Name { get; set; } /// /// A description for the JsonItem. /// string Description { get; set; } /// /// The JsonItem path in the related object graph. /// string Path { get; } /// /// IEnumerable of all sub JsonItems. /// [JsonIgnore] IEnumerable Children { get; } /// /// If the JsonItem is a children of an other JsonItem, the parent will be this other JsonItem. /// [JsonIgnore] IJsonItem Parent { get; set; } /// /// Returns a validator with integrated caching to validate the JsonItem and all children. /// /// JsonItemValidator IJsonItemValidator GetValidator(); /// /// Add sub JsonItems. /// /// void AddChildren(params IJsonItem[] childs); void AddChildren(IEnumerable childs); /// /// This method fixates the path. /// After calling, the path cannot be changed by changing the name or parent. /// void FixatePath(); /// /// This method looses the path again after a call of FixatePath. /// After calling, the path is calculated by the position in item tree again. /// void LoosenPath(); /// /// Method to generate a Newtonsoft JObject, which describes the JsonItem. /// /// Newtonsoft JObject JObject GenerateJObject(); /// /// To set all necessary JsonItem properties with an given Newtonsoft JObject. /// /// Newtonsoft JObject void SetJObject(JObject jObject); } }