#ifndef CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H
#define CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H

#include "FourBarMechanism/CrankSliderMechanism.h"
#include <vector>
#include <string>
#include <map>
#include <memory>

// 曲柄摇块机构（逆解）
class CrankRockingBlockMechanism_Inverse
{
private:
    std::string name;
    MechanismType type;
    MechanismParameters parameters;
    std::vector<Vector2D> trajectoryPoints;

public:
    CrankRockingBlockMechanism_Inverse();

    // 基本属性
    std::string getName() const;
    MechanismType getType() const;
    MechanismParameters getParameters() const;
    void setParameters(const MechanismParameters &params);

    // 设置连杆长度
    void setLink(double OA, double AB, double OC);
    void setOA(double length);
    void setAB(double length);
    void setOC(double distance);

    // 主要计算函数
    MechanismState calculate(double acDistance);

    // 获取输入范围
    std::pair<double, double> getInputRange();

    // 轨迹相关
    std::vector<Vector2D> getTrajectoryPoints() const;
    void clearTrajectory();

    // 参数验证
    ValidationResult validateParameters();

    // 状态信息
    std::string getStatusText();

private:
    std::pair<double, double> getACRange() const;
};

#endif // CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H
