using System.Text.Json.Serialization;
using TakeoutSaaS.Shared.Abstractions.Serialization;
namespace TakeoutSaaS.Application.Identity.Contracts;
///
/// 权限树节点 DTO。
///
public sealed record PermissionTreeDto
{
///
/// 权限 ID(雪花,序列化为字符串)。
///
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long Id { get; init; }
///
/// 租户 ID(雪花,序列化为字符串)。
///
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long TenantId { get; init; }
///
/// 父级权限 ID。
///
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long ParentId { get; init; }
///
/// 排序值,值越小越靠前。
///
public int SortOrder { get; init; }
///
/// 权限类型(group/leaf)。
///
public string Type { get; init; } = string.Empty;
///
/// 权限名称。
///
public string Name { get; init; } = string.Empty;
///
/// 权限编码(租户内唯一)。
///
public string Code { get; init; } = string.Empty;
///
/// 描述。
///
public string? Description { get; init; }
///
/// 子节点集合。
///
public IReadOnlyList Children { get; init; } = Array.Empty();
}