namespace TrackQrApi.Models;

public class ApiKey
{
    public Guid Id { get; set; }
    public Guid WorkspaceId { get; set; }
    public required string Name { get; set; }
    public required string KeyHash { get; set; } // Only store hash, never the raw key
    public required string KeyPrefix { get; set; } // First 8 chars for identification (e.g., "trk_abc1...")
    public DateTime CreatedAt { get; set; }
    public DateTime? LastUsedAt { get; set; }
    public DateTime? ExpiresAt { get; set; }
    public bool IsActive { get; set; } = true;
    public List<string>? Scopes { get; set; } // e.g., ["links:read", "links:write", "qrcodes:read"]

    public Workspace Workspace { get; set; } = null!;
}