using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//
// This is here so CodeMaid doesn't reorganize this document
//
namespace LiMan.DB.DBModels
{
[Table("EnrollRequest")]
public partial class EnrollRequestModel
{
///
/// ID univoco
///
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdReq { get; set; }
///
/// Passcode usato epr autorizzare (rnd al momento della richiesta)
///
public int Passcode { get; set; } = 0;
///
/// Payload richiesta, ovvero la serializzazione json di un Dict[string,string] delle info ricevute
///
public string ReqPayload { get; set; } = "";
///
/// DataOra richiesta enroll
///
public DateTime DtReq { get; set; } = DateTime.Now;
///
/// DataOra approvazione
///
public DateTime? DtAppr { get; set; } = null;
///
/// Username approvatore
///
public string UserAppr { get; set; } = "";
///
/// Licenza fornita in risposta alla richiesta
///
public int IdxLic { get; set; } = 0;
///
/// Indica Scaduta se non approvata e richiesta da oltre 15 minuti
///
[NotMapped]
public bool IsScaduta
{
get => DtAppr == null && DateTime.Now.Subtract(DtReq).TotalMinutes > 15;
}
}
}