namespace SharepointToolbox.Core.Models;

/// <summary>
/// A consolidated permission row produced by grouping UserAccessEntry rows
/// that share the same (UserLogin, PermissionLevel, AccessType, GrantedThrough) key.
/// All distinct locations for that key are collected into <see cref="Locations"/>.
/// </summary>
public record ConsolidatedPermissionEntry(
    string UserDisplayName,
    string UserLogin,
    string PermissionLevel,
    AccessType AccessType,
    string GrantedThrough,
    bool IsHighPrivilege,
    bool IsExternalUser,
    IReadOnlyList<LocationInfo> Locations,
    string? TargetUrl = null,
    string? TargetLabel = null,
    string? SharingLinkType = null
)
{
    /// <summary>Convenience count — equals Locations.Count.</summary>
    public int LocationCount => Locations.Count;
}
