//-----------------------------------------------------------------------
//
// Copyright (c) lanedirt. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
//
//-----------------------------------------------------------------------
namespace AliasServerDb;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Identity;
///
/// Refresh tokens for users.
///
public class AliasVaultUserRefreshToken
{
///
/// Gets or sets Refresh Token ID.
///
[Key]
public Guid Id { get; set; }
///
/// Gets or sets user ID foreign key.
///
[StringLength(255)]
public string UserId { get; set; } = null!;
///
/// Gets or sets foreign key to the AliasVaultUser object.
///
[ForeignKey("UserId")]
public virtual AliasVaultUser User { get; set; } = null!;
///
/// Gets or sets the device identifier (one token per device).
///
[StringLength(255)]
public string DeviceIdentifier { get; set; } = null!;
///
/// Gets or sets the IP address associated with the refresh token.
///
[StringLength(45)]
public string? IpAddress { get; set; }
///
/// Gets or sets the token value.
///
[StringLength(255)]
public string Value { get; set; } = null!;
///
/// Gets or sets the previous token value that was replaced by the current one (optional).
/// This is used to allow a short reuse window where if multiple refresh requests are
/// made in quick succession they all get the same new refresh token.
///
[StringLength(255)]
public string? PreviousTokenValue { get; set; }
///
/// Gets or sets the expiration date.
///
[StringLength(255)]
public DateTime ExpireDate { get; set; }
///
/// Gets or sets created timestamp.
///
public DateTime CreatedAt { get; set; }
}