using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("user_security_key")]
[Index("PublicKey")]
[Index("UserId")]
public class UserSecurityKey {
///
/// Variable-length id given to navigator.credentials.get()
///
[Key]
[Column("id", TypeName = "character varying")]
public string Id { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
///
/// Variable-length public key used to verify attestations (hex-encoded).
///
[Column("publicKey", TypeName = "character varying")]
public string PublicKey { get; set; } = null!;
///
/// The date of the last time the UserSecurityKey was successfully validated.
///
[Column("lastUsed")]
public DateTime LastUsed { get; set; }
///
/// User-defined name for this key
///
[Column("name")]
[StringLength(30)]
public string Name { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty(nameof(Tables.User.UserSecurityKeys))]
public virtual User User { get; set; } = null!;
}