#pragma once

#include "control_calibration_service/control_calibration_algorithms.hpp"

#include "calibration_common_interfaces/msg/error_code.hpp"

namespace control_calibration_service
{

// 统一填充一份最小可运行但不可自动提交的默认结果。
// 作用：
// 1. 让模板文件在尚未接入真实算法时也能稳定返回一份结构完整的结果；
// 2. 让算法工程师明确最终结果要写入哪些字段；
// 3. 避免占位模板在真实现场被误判成“可写入车辆”的参数；
// 4. 后续真实算法接入时，可以保留这层公共默认值，再按算法结果覆盖具体字段。
inline void fill_common_result(
  const ControlCalibrationInput & input,
  ControlCalibrationOutput & output)
{
  output.response.result.success = true;
  output.response.result.error_code.code = calibration_common_interfaces::msg::ErrorCode::OK;
  output.response.result.message = "control calibration template executed.";
  output.response.result.job_id = input.request.goal.header.request_id;
  output.response.result.data_quality_passed = false;
  output.response.result.suitable_for_commit = false;
  output.response.result.recommended_parameter_version = "template_not_commit_ready";
  output.response.result.validation_summary.rms_lateral_error_m = 0.0;
  output.response.result.validation_summary.rms_heading_error_rad = 0.0;
  output.response.result.validation_summary.rms_speed_error_ms = 0.0;
  output.response.result.validation_summary.overshoot_ratio = 0.0;
  output.response.result.validation_summary.settle_time_sec = 0.0;
  output.response.result.validation_summary.stop_position_error_m = 0.0;
  output.response.result.validation_summary.max_jerk = 0.0;
  output.response.result.validation_summary.saturation_ratio = 0.0;
  output.response.result.validation_summary.auto_acceptance_passed = false;
}

}  // namespace control_calibration_service
