using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using e_suite.Database.Audit.Attributes;
using e_suite.Database.Audit.Models;
using Microsoft.EntityFrameworkCore;

namespace e_suite.Database.Core.Tables.UserManager;

[NoAudit]
[Table("SingleUseGuids", Schema = "UserManager")]
[Index(nameof(Guid), IsUnique = true)]
public class SingleUseGuid : IId
{
    [Key]
    public long Id { get; set; }

    [Required]
    public long UserId { get; set; }

    [Required]
    public Guid Guid { get; set; }

    [Required]
    public DateTimeOffset Expires { get; set; }

    [ForeignKey(nameof(UserId))]
    public virtual User User { get; set; } = null!;
}