namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;

/// <summary>
///     v3 Raw-tree driver-organizing folder. Nestable (Kepware-style) directly under a cluster or
///     under another <see cref="RawFolder"/>. Folders group <see cref="DriverInstance"/> rows; they
///     contribute the leading segments of a driver's <c>RawPath</c>.
/// </summary>
public sealed class RawFolder
{
    /// <summary>Gets or sets the database row identifier (PK).</summary>
    public Guid RawFolderRowId { get; set; }

    /// <summary>Stable logical ID, unique fleet-wide.</summary>
    public required string RawFolderId { get; set; }

    /// <summary>Logical FK to <see cref="ServerCluster.ClusterId"/> — the folder is cluster-rooted.</summary>
    public required string ClusterId { get; set; }

    /// <summary>Logical FK to a parent <see cref="RawFolder.RawFolderId"/>; <see langword="null"/> = root under the cluster.</summary>
    public string? ParentRawFolderId { get; set; }

    /// <summary>Sibling-unique folder name. A RawPath segment: no <c>/</c>, no lead/trail whitespace.</summary>
    public required string Name { get; set; }

    /// <summary>Sibling display ordering.</summary>
    public int SortOrder { get; set; }

    /// <summary>Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.</summary>
    public byte[] RowVersion { get; set; } = Array.Empty<byte>();
}
