using System;
namespace Jellyfin.Plugin.ShareLinks.Models;
///
/// Persistent share-link record. Only the token hash is stored; the raw token
/// never enters durable storage.
///
public sealed class ShareLinkRecord
{
/// Gets or sets the share-link id.
public Guid Id { get; set; } = Guid.NewGuid();
/// Gets or sets the HMAC hash of the token.
public string TokenHash { get; set; } = string.Empty;
/// Gets or sets the Jellyfin item id snapshot.
public string ItemId { get; set; } = string.Empty;
/// Gets or sets the Jellyfin item name snapshot.
public string ItemNameSnapshot { get; set; } = string.Empty;
/// Gets or sets the library id snapshot.
public string? LibraryId { get; set; }
/// Gets or sets the user id that created the link.
public Guid? CreatedByUserId { get; set; }
/// Gets or sets the UTC creation time.
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
/// Gets or sets the UTC redemption time, if any.
public DateTimeOffset? RedeemedAtUtc { get; set; }
/// Gets or sets the UTC expiry time.
public DateTimeOffset ExpiresAtUtc { get; set; }
/// Gets or sets the current lifecycle status.
public ShareLinkStatus Status { get; set; } = ShareLinkStatus.Pending;
/// Gets or sets the guest user id associated with the link.
public Guid? GuestUserId { get; set; }
/// Gets or sets the guest user name associated with the link.
public string? GuestUserName { get; set; }
/// Gets or sets the access token id used by the guest session, if available.
public string? AccessTokenId { get; set; }
/// Gets or sets the device id used by the guest session, if available.
public string? DeviceId { get; set; }
/// Gets or sets the allowed tag snapshot, if any.
public string? AllowedTag { get; set; }
/// Gets or sets a value indicating whether the link may be used once only.
public bool OneUse { get; set; } = true;
/// Gets or sets the encrypted guest password, if one has been generated.
public string? GuestPasswordEncrypted { get; set; }
/// Gets or sets a value indicating whether metadata was touched during cleanup.
public bool MetadataTouched { get; set; }
/// Gets or sets the number of cleanup attempts performed on this record.
public int CleanupAttempts { get; set; }
/// Gets or sets the last cleanup error, if any.
public string? CleanupError { get; set; }
}