using System;
using System.Collections.Generic;
using System.Linq;
using Speckle.Core.Models;
using Speckle.Newtonsoft.Json;
namespace Objects.BuiltElements;
///
/// Represents graph connections between built elements objects
///
///
/// Network may need to be created first in native applications before they are linked.
///
[Obsolete("Networks are no longer used in any connector to assemble MEP systems.")]
public class Network : Base
{
public Network() { }
public string name { get; set; }
///
/// The elements contained in the network
///
public List elements { get; set; }
///
/// The connections between
///
public List links { get; set; }
}
[Obsolete("Networks are no longer used in any connector to assemble MEP systems.")]
public class NetworkElement : Base
{
public NetworkElement() { }
public string name { get; set; }
///
/// The Base object representing the element in the network (eg Pipe, Duct, etc)
///
///
/// Currently named "elements" to assist with receiving in connector flatten method.
///
[DetachProperty]
public Base elements { get; set; }
///
/// The index of the links in that are connected to this element
///
public List linkIndices { get; set; }
[JsonIgnore]
public Network network { get; set; }
///
/// Retrieves the links for this element
///
[JsonIgnore]
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type. Reason: obsolete.
public List links => linkIndices.Select(i => network?.links[i]).ToList();
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type. Reason: obsolete.
}
[Obsolete("Networks are no longer used in any connector to assemble MEP systems.")]
public class NetworkLink : Base
{
public NetworkLink() { }
public string name { get; set; }
///
/// The index of the elements in that are connected by this link
///
public List elementIndices { get; set; }
[JsonIgnore]
public Network network { get; set; }
///
/// Retrieves the elements for this link
///
[JsonIgnore]
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type. Reason: obsolete.
public List elements => elementIndices.Select(i => network?.elements[i]).ToList();
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type. Reason: obsolete.
}