#pragma once

#include <cstdint>
#include <string>

namespace workshop_orchestrator_v2
{

// 对齐 src/communication/win_ubuntu_bridge/*/proto/transport_contract.proto。
// 这个 client 只用于 orchestrator 预检四条 WiFi6/TCP 链路，不承载专项算法逻辑。
class Wifi6LinkClient
{
public:
  struct Config
  {
    std::string vehicle_host{"127.0.0.1"};
    uint16_t vehicle_port{9000};
    int timeout_ms{5000};
  };

  struct CheckResult
  {
    bool passed{false};
    std::string message;
  };

  explicit Wifi6LinkClient(Config config);

  CheckResult check_chassis() const;
  CheckResult check_control() const;
  CheckResult check_sensor() const;
  CheckResult check_external_pose() const;

private:
  enum class FrameType : uint32_t
  {
    CHASSIS_GET_READINESS_REQ = 1,
    CHASSIS_GET_READINESS_RSP = 2,
    CONTROL_GET_READINESS_REQ = 11,
    CONTROL_GET_READINESS_RSP = 12,
    SENSOR_GET_READINESS_REQ = 21,
    SENSOR_GET_READINESS_RSP = 22,
    EXTERNAL_POSE_PUSH_REQ = 31,
    EXTERNAL_POSE_PUSH_RSP = 32,
  };

  CheckResult send_json_request(
    FrameType request_type,
    FrameType response_type,
    const std::string & request_payload,
    const std::string & link_name) const;

  Config config_;
};

}  // namespace workshop_orchestrator_v2
