namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
///
/// Staged equipment-import batch per Phase 6.4 Stream B.2. Rows land in the child
/// table under a batch header; operator reviews + either
/// drops (via DropImportBatch) or finalises (via FinaliseImportBatch) in one
/// bounded transaction. The live Equipment table never sees partial state.
///
///
/// User-scoped visibility: the preview modal only shows batches where
/// equals the current operator. Prevents accidental
/// cross-operator finalise during concurrent imports. An admin finalise / drop surface
/// can override this — tracked alongside the UI follow-up.
///
/// stamps the moment the batch promoted from staging
/// into Equipment. Null = still in staging; non-null = archived / finalised.
///
public sealed class EquipmentImportBatch
{
public Guid Id { get; set; }
public required string ClusterId { get; set; }
public required string CreatedBy { get; set; }
public DateTime CreatedAtUtc { get; set; }
public int RowsStaged { get; set; }
public int RowsAccepted { get; set; }
public int RowsRejected { get; set; }
public DateTime? FinalisedAtUtc { get; set; }
public ICollection Rows { get; set; } = [];
}
///
/// One staged row under an . Mirrors the decision #117
/// + decision #139 columns from the CSV importer's output + an
/// flag + a string the preview modal
/// renders.
///
public sealed class EquipmentImportRow
{
public Guid Id { get; set; }
public Guid BatchId { get; set; }
public int LineNumberInFile { get; set; }
public bool IsAccepted { get; set; }
public string? RejectReason { get; set; }
// Required (decision #117)
public required string ZTag { get; set; }
public required string MachineCode { get; set; }
public required string SAPID { get; set; }
public required string EquipmentId { get; set; }
public required string EquipmentUuid { get; set; }
public required string Name { get; set; }
public required string UnsAreaName { get; set; }
public required string UnsLineName { get; set; }
// Optional (decision #139 — OPC 40010 Identification)
public string? Manufacturer { get; set; }
public string? Model { get; set; }
public string? SerialNumber { get; set; }
public string? HardwareRevision { get; set; }
public string? SoftwareRevision { get; set; }
public string? YearOfConstruction { get; set; }
public string? AssetLocation { get; set; }
public string? ManufacturerUri { get; set; }
public string? DeviceManualUri { get; set; }
public EquipmentImportBatch? Batch { get; set; }
}