using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
///
/// Fleet-wide rollback-safe reservation of ZTag and SAPID. Per decision #124 — NOT generation-versioned.
/// Exists outside generation flow specifically because old generations and disabled equipment can
/// still hold the same external IDs; per-generation uniqueness indexes fail under rollback/re-enable.
///
public sealed class ExternalIdReservation
{
/// Gets or sets the unique reservation identifier.
public Guid ReservationId { get; set; }
/// Gets or sets the kind of reservation (ZTag or SAPID).
public required ReservationKind Kind { get; set; }
/// Gets or sets the reserved external ID value.
public required string Value { get; set; }
/// The equipment that owns this reservation. Stays bound even when equipment is disabled.
public Guid EquipmentUuid { get; set; }
/// First cluster to publish this reservation.
public required string ClusterId { get; set; }
/// Gets or sets the timestamp when the reservation was first published.
public DateTime FirstPublishedAt { get; set; } = DateTime.UtcNow;
/// Gets or sets the identifier of the user or system that first published the reservation.
public required string FirstPublishedBy { get; set; }
/// Gets or sets the timestamp of the most recent publication.
public DateTime LastPublishedAt { get; set; } = DateTime.UtcNow;
/// Non-null when explicitly released by FleetAdmin (audit-logged, requires reason).
public DateTime? ReleasedAt { get; set; }
/// Gets or sets the identifier of the user or system that released the reservation.
public string? ReleasedBy { get; set; }
/// Gets or sets the reason for releasing the reservation.
public string? ReleaseReason { get; set; }
}