namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances;

public class Area
{
    /// <summary>Gets or sets the database primary key.</summary>
    public int Id { get; set; }
    /// <summary>Gets or sets the id of the site this area belongs to.</summary>
    public int SiteId { get; set; }
    /// <summary>Gets or sets the display name of the area.</summary>
    public string Name { get; set; }
    /// <summary>Gets or sets the id of the parent area, or null for a root area.</summary>
    public int? ParentAreaId { get; set; }
    /// <summary>Gets or sets the child areas nested under this area.</summary>
    public ICollection<Area> Children { get; set; } = new List<Area>();

    /// <summary>
    /// Initializes a new <see cref="Area"/> with the given name.
    /// </summary>
    /// <param name="name">Display name for the area.</param>
    public Area(string name)
    {
        Name = name ?? throw new ArgumentNullException(nameof(name));
    }
}
