import 'package:ef/ef.dart';
import 'package:json_annotation/json_annotation.dart';

part 'mht_device_calibration_controller.g.dart'; // 由json_serializable自动生成的部分

@JsonSerializable()
class MHTDeviceCalibrationModel {
  MHTDeviceCalibrationModel();

  factory MHTDeviceCalibrationModel.fromJson(Map<String, dynamic> json) {
    try {
      return _$MHTDeviceCalibrationModelFromJson(json);
    } catch (e) {
      return MHTDeviceCalibrationModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
    }
  }

  // 序列化为JSON时的异常处理
  Map<String, dynamic> toJson() => _$MHTDeviceCalibrationModelToJson(this);
}

class MHTDeviceCalibrationController
    extends GetControllerEx<MHTDeviceCalibrationModel> {
  MHTDeviceCalibrationController() {
    attr = GetModel(MHTDeviceCalibrationModel()).obs;
  }

  RxInt process = 0.obs; //校准流程 0.离床校准 1.位置校准
  RxInt bed_calibration = 0.obs; //0.未完成 1.完成
  RxInt position_calibration = 0.obs; //0.未完成 1.完成
  RxInt bed_type = 0.obs; //0.单人 1.双人
  RxString tips = "".obs;
  RxInt flag = 0.obs; //0没有开始 1：校准中 2.校准完成 3.校准失败
  RxString statusContext = "".obs;
  RxBool another = false.obs;
  

  RxInt cd = 10000.obs;
  bool forceStart  = false;

  RxInt motionTips = 0.obs;//体动提示
  RxInt inBedTips = 0.obs;//在床提示
}
