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
{
/// Gets or sets the unique identifier for this batch.
public Guid Id { get; set; }
/// Gets or sets the cluster identifier.
public required string ClusterId { get; set; }
/// Gets or sets the user name who created this batch.
public required string CreatedBy { get; set; }
/// Gets or sets the UTC timestamp when this batch was created.
public DateTime CreatedAtUtc { get; set; }
/// Gets or sets the total number of rows staged in this batch.
public int RowsStaged { get; set; }
/// Gets or sets the number of rows accepted in this batch.
public int RowsAccepted { get; set; }
/// Gets or sets the number of rows rejected in this batch.
public int RowsRejected { get; set; }
/// Gets or sets the UTC timestamp when this batch was finalised, or null if still in staging.
public DateTime? FinalisedAtUtc { get; set; }
/// Gets or sets the collection of staged rows in this batch.
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
{
/// Gets or sets the unique identifier for this row.
public Guid Id { get; set; }
/// Gets or sets the parent batch identifier.
public Guid BatchId { get; set; }
/// Gets or sets the line number in the source file.
public int LineNumberInFile { get; set; }
/// Gets or sets a value indicating whether this row was accepted.
public bool IsAccepted { get; set; }
/// Gets or sets the reason this row was rejected, if applicable.
public string? RejectReason { get; set; }
// Required (decision #117)
/// Gets or sets the Z tag identifier.
public required string ZTag { get; set; }
/// Gets or sets the machine code.
public required string MachineCode { get; set; }
/// Gets or sets the SAP identifier.
public required string SAPID { get; set; }
/// Gets or sets the equipment identifier.
public required string EquipmentId { get; set; }
/// Gets or sets the equipment UUID.
public required string EquipmentUuid { get; set; }
/// Gets or sets the equipment name.
public required string Name { get; set; }
/// Gets or sets the UNS area name.
public required string UnsAreaName { get; set; }
/// Gets or sets the UNS line name.
public required string UnsLineName { get; set; }
// Optional (decision #139 — OPC 40010 Identification)
/// Gets or sets the manufacturer name.
public string? Manufacturer { get; set; }
/// Gets or sets the equipment model.
public string? Model { get; set; }
/// Gets or sets the serial number.
public string? SerialNumber { get; set; }
/// Gets or sets the hardware revision.
public string? HardwareRevision { get; set; }
/// Gets or sets the software revision.
public string? SoftwareRevision { get; set; }
/// Gets or sets the year of construction.
public string? YearOfConstruction { get; set; }
/// Gets or sets the asset location.
public string? AssetLocation { get; set; }
/// Gets or sets the manufacturer URI.
public string? ManufacturerUri { get; set; }
/// Gets or sets the device manual URI.
public string? DeviceManualUri { get; set; }
/// Gets or sets the parent batch.
public EquipmentImportBatch? Batch { get; set; }
}