68 lines
2.5 KiB
C#
68 lines
2.5 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Fitness_core_BE.Models
|
|
{
|
|
/// <summary>
|
|
/// Tenant-scoped physical-access identity. A platform user can belong to several
|
|
/// gyms, but receives one independent access profile per gym.
|
|
/// </summary>
|
|
public class AccessProfile
|
|
{
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public long AccessProfileId { get; set; }
|
|
|
|
public Guid FKClientId { get; set; }
|
|
[ForeignKey(nameof(FKClientId))]
|
|
public Client Client { get; set; } = null!;
|
|
|
|
public Guid FKUserId { get; set; }
|
|
[ForeignKey(nameof(FKUserId))]
|
|
public User User { get; set; } = null!;
|
|
|
|
[MaxLength(20)]
|
|
public string PersonType { get; set; } = "Customer";
|
|
|
|
[MaxLength(128)]
|
|
public string DisplayName { get; set; } = string.Empty;
|
|
|
|
[MaxLength(20)]
|
|
public string DesiredAccessState { get; set; } = "Enabled";
|
|
|
|
public int DesiredVersion { get; set; } = 1;
|
|
|
|
[MaxLength(100)]
|
|
public string? LockReason { get; set; }
|
|
|
|
public DateTime? LockedAt { get; set; }
|
|
|
|
// ---- Face photo (Hikvision face library) ----
|
|
// The image itself is never persisted here: it travels in the UpsertFacePhoto
|
|
// DeviceCommand payload only until the terminal confirms enrolment, at which point
|
|
// the payload is purged. What survives is the enrolment state plus the device-side
|
|
// record id, which is what a later replace/delete needs.
|
|
|
|
/// <summary>True once the terminal has accepted a face for this profile.</summary>
|
|
public bool HasFacePhoto { get; set; }
|
|
|
|
/// <summary>"None" | "Pending" | "Synced" | "Failed".</summary>
|
|
[MaxLength(20)]
|
|
public string FacePhotoStatus { get; set; } = "None";
|
|
|
|
/// <summary>Hikvision face-record id (FPID) returned on enrolment.</summary>
|
|
[MaxLength(64)]
|
|
public string? FacePhotoFPID { get; set; }
|
|
|
|
/// <summary>Why the terminal rejected the face (not frontal, eyes closed, ...).</summary>
|
|
[MaxLength(500)]
|
|
public string? FacePhotoError { get; set; }
|
|
|
|
public DateTime? FacePhotoUpdatedAt { get; set; }
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public ICollection<AccessDeviceBinding> DeviceBindings { get; set; } = new List<AccessDeviceBinding>();
|
|
}
|
|
}
|