using System.Text.Json.Serialization;
using Bit.Core.Utilities;
namespace Bit.Core.Tokens;
public abstract class ExpiringTokenable : Tokenable
{
[JsonConverter(typeof(EpochDateTimeJsonConverter))]
public DateTime ExpirationDate { get; set; }
///
/// Checks if the token is still within its valid duration and if its data is valid.
/// For data validation, this property relies on the method.
///
public override bool Valid => ExpirationDate > DateTime.UtcNow && TokenIsValid();
///
/// Validates that the token data properties are correct.
/// For expiration checks, refer to the property.
///
protected abstract bool TokenIsValid();
}