using CommunityToolkit.Mvvm.ComponentModel;
namespace ivf_tl_Operate.ViewModel
{
// ──────────────────────────────────────────────────────────────────────────────
// M1-B2 去重:DebugSerialAdapter / DebugCameraAdapter(把 operate B 栈具体类型
// ivf_tl_Entity.ComEntitys.ComBin / ivf_tl_Entity.CameraEntitys.Camera 适配成 HAL
// 接口)已退役并删除。调试页一键标定现直接把借用到的 lease.Serial/lease.Camera
// (HAL ISerialChannel/ICamera,A 栈 control 句柄)喂给 CalibrationEngine
// (见 HouseDebugPageViewModel 一键标定:new CalibrationEngine(Serial, Cam)),
// 不再经这两个适配器包 B 栈具体类型。删除它们后本文件不再引用 B 栈 ComBin。
// ──────────────────────────────────────────────────────────────────────────────
/// M2-05 单 well 标定 UI 状态:待标定/标定中/合格(绿)/伪峰(红)/失败(红)。
public enum WellCalibState { Pending, Running, Qualified, FakePeak, Failed }
///
/// M2-05 一键标定单 well UI 结果项(绑定调试页 16 格实时显示)。
/// 合格(Qualified)绿、伪峰/失败(FakePeak/Failed)红;含 FocusZ/峰比/偏移/曝光/Note。
/// 实现 ObservableObject 以便每 well 标定完即时刷新对应格子。
/// 颜色判定建议在 View 用 DataTrigger 绑定 State(绿=Qualified,红=FakePeak|Failed,中性=Pending|Running)。
///
public partial class WellCalibUiItem : ObservableObject
{
[ObservableProperty] private int well;
[ObservableProperty] private WellCalibState state = WellCalibState.Pending;
[ObservableProperty] private int focusZ;
[ObservableProperty] private double peakRatio;
[ObservableProperty] private double centerOffsetPct;
[ObservableProperty] private bool circleFound;
[ObservableProperty] private int exposure;
[ObservableProperty] private string note = "";
/// 是否合格(供 View 直接绑定做绿/红,等价 State==Qualified)。
public bool IsQualified => State == WellCalibState.Qualified;
}
///
/// M2-07 对焦后手调拍摄层 · 单层预览项(绑定预览列表,让工程师看到调整后各层绝对 Z)。
/// 由 PhotoLayerCalculator.ComputeLayerPositions(标定FocusZ, 手调cfg, pulseMax) 生成;
/// IsFocusLayer 标记清晰层(第 down 层)以便 View 高亮。
///
public partial class LayerPreviewItem : ObservableObject
{
/// 层序号(0 .. count-1,0=对焦起点)。
[ObservableProperty] private int layerIndex;
/// 该层绝对 Z 脉冲(公式算出,含 pulseMax 钳位)。
[ObservableProperty] private int zPulse;
/// 是否为清晰层(即第 down 层,对焦锚点 FocusZ 所在层)。
[ObservableProperty] private bool isFocusLayer;
}
}