#pragma once

#include "sensor_calibration_service/sensor_calibration_algorithms.hpp"

#include "calibration_common_interfaces/msg/error_code.hpp"

namespace sensor_calibration_service
{

// 统一填充一份最小可运行的默认结果。
// 作用：
// 1. 让模板文件在尚未接入真实算法时也能稳定返回一份结构完整的结果；
// 2. 让算法工程师明确最终结果要写入哪些字段；
// 3. 后续真实算法接入时，可以保留这层公共默认值，再按算法结果覆盖具体字段。
inline void fill_common_result(
  const SensorCalibrationInput & input,
  SensorCalibrationOutput & output)
{
  output.response.result.success = true;
  output.response.result.error_code.code = calibration_common_interfaces::msg::ErrorCode::OK;
  output.response.result.message = "sensor calibration template executed.";
  output.response.result.job_id = input.request.goal.header.request_id;
  output.response.result.data_quality_passed = true;
  output.response.result.suitable_for_commit = true;
  output.response.result.recommended_parameter_version = "demo_sensor_template_v1";
  output.response.result.validation_summary.reprojection_error_px = 0.0;
  output.response.result.validation_summary.translation_residual_m = 0.0;
  output.response.result.validation_summary.rotation_residual_rad = 0.0;
  output.response.result.validation_summary.plane_residual_m = 0.0;
  output.response.result.validation_summary.repeatability_error_m = 0.0;
  output.response.result.validation_summary.auto_acceptance_passed = true;
}

}  // namespace sensor_calibration_service
