namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS;
///
/// FOCAS driver configuration. One instance supports N CNC devices. Per plan decision #144
/// each device gets its own (DriverInstanceId, HostAddress) bulkhead key at the
/// Phase 6.1 resilience layer.
///
public sealed class FocasDriverOptions
{
public IReadOnlyList Devices { get; init; } = [];
public IReadOnlyList Tags { get; init; } = [];
public FocasProbeOptions Probe { get; init; } = new();
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
///
/// Fixed-tree behaviour knobs (issue #262, plan PR F1-f). Carries the
/// ApplyFigureScaling toggle that gates the cnc_getfigure
/// decimal-place division applied to position values before publishing.
///
public FocasFixedTreeOptions FixedTree { get; init; } = new();
}
///
/// Per-driver fixed-tree options. New installs default
/// to true so position values surface in user units (mm / inch). Existing
/// deployments that already published raw scaled integers can flip this to false
/// for migration parity — the operator-facing concern is that switching the flag
/// mid-deployment changes the values clients see, so the migration path is
/// documentation-only (issue #262).
///
public sealed record FocasFixedTreeOptions
{
///
/// When true (default), position values from cnc_absolute /
/// cnc_machine / cnc_relative / cnc_distance /
/// cnc_actf are divided by 10^decimalPlaces per axis using the
/// cnc_getfigure snapshot cached at probe time. When false, the
/// raw integer values are published unchanged — used for migrations from
/// older drivers that didn't apply the scaling.
///
public bool ApplyFigureScaling { get; init; } = true;
}
///
/// One CNC the driver talks to. enables per-series
/// address validation at ; leave as
/// to skip validation (legacy behaviour).
/// declares the four MTB-specific override
/// cnc_rdparam numbers surfaced under Override/; pass null to
/// suppress the entire Override/ subfolder for that device (issue #259).
///
public sealed record FocasDeviceOptions(
string HostAddress,
string? DeviceName = null,
FocasCncSeries Series = FocasCncSeries.Unknown,
FocasOverrideParameters? OverrideParameters = null);
///
/// One FOCAS-backed OPC UA variable. is the canonical FOCAS
/// address string that parses via —
/// X0.0 / R100 / PARAM:1815/0 / MACRO:500 /
/// DIAG:1031 / DIAG:280/2.
///
public sealed record FocasTagDefinition(
string Name,
string DeviceHostAddress,
string Address,
FocasDataType DataType,
bool Writable = true,
bool WriteIdempotent = false);
public sealed class FocasProbeOptions
{
public bool Enabled { get; init; } = true;
public TimeSpan Interval { get; init; } = TimeSpan.FromSeconds(5);
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(2);
}