package com.css.simulation.resource.server.infra.util;

import api.common.pojo.po.model.VehiclePO;
import api.common.pojo.vo.model.VehicleVO;
import api.common.util.JsonUtil;
import lombok.SneakyThrows;

public class VehicleUtil {

    @SneakyThrows
    public static void listToJson(VehiclePO vehiclePO) {
        vehiclePO.setFrontLeftWheelRelationCurvePositiveMomentAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getFrontLeftWheelRelationCurvePositiveMomentAndSideslipAngle()));
        vehiclePO.setFrontLeftWheelRelationCurveLateralForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getFrontLeftWheelRelationCurveLateralForceAndSideslipAngle()));
        vehiclePO.setFrontLeftWheelRelationCurveLongitudinalForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getFrontLeftWheelRelationCurveLongitudinalForceAndSideslipAngle()));

        vehiclePO.setRearLeftWheelRelationCurvePositiveMomentAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getRearLeftWheelRelationCurvePositiveMomentAndSideslipAngle()));
        vehiclePO.setRearLeftWheelRelationCurveLateralForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getRearLeftWheelRelationCurveLateralForceAndSideslipAngle()));
        vehiclePO.setRearLeftWheelRelationCurveLongitudinalForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getRearLeftWheelRelationCurveLongitudinalForceAndSideslipAngle()));

        vehiclePO.setFrontRightWheelRelationCurvePositiveMomentAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getFrontRightWheelRelationCurvePositiveMomentAndSideslipAngle()));
        vehiclePO.setFrontRightWheelRelationCurveLateralForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getFrontRightWheelRelationCurveLateralForceAndSideslipAngle()));
        vehiclePO.setFrontRightWheelRelationCurveLongitudinalForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getFrontRightWheelRelationCurveLongitudinalForceAndSideslipAngle()));

        vehiclePO.setRearRightWheelRelationCurvePositiveMomentAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getRearRightWheelRelationCurvePositiveMomentAndSideslipAngle()));
        vehiclePO.setRearRightWheelRelationCurveLateralForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getRearRightWheelRelationCurveLateralForceAndSideslipAngle()));
        vehiclePO.setRearRightWheelRelationCurveLongitudinalForceAndSideslipAngleJson(JsonUtil.listToJson(vehiclePO.getRearRightWheelRelationCurveLongitudinalForceAndSideslipAngle()));

        vehiclePO.setRelationCurveEngineTorqueSpeedAndThrottleOpeningJson(JsonUtil.listToJson(vehiclePO.getRelationCurveEngineTorqueSpeedAndThrottleOpening()));

        vehiclePO.setGearRatioJson(JsonUtil.listToJson(vehiclePO.getGearRatio()));
        vehiclePO.setInertiaJson(JsonUtil.listToJson(vehiclePO.getInertia()));
        vehiclePO.setDrivingJson(JsonUtil.listToJson(vehiclePO.getDriving()));
        vehiclePO.setCoastingJson(JsonUtil.listToJson(vehiclePO.getCoasting()));

        vehiclePO.setShiftTimeUp12Json(JsonUtil.listToJson(vehiclePO.getShiftTimeUp12()));
        vehiclePO.setShiftTimeUp23Json(JsonUtil.listToJson(vehiclePO.getShiftTimeUp23()));
        vehiclePO.setShiftTimeUp34Json(JsonUtil.listToJson(vehiclePO.getShiftTimeUp34()));
        vehiclePO.setShiftTimeUp45Json(JsonUtil.listToJson(vehiclePO.getShiftTimeUp45()));
        vehiclePO.setShiftTimeUp56Json(JsonUtil.listToJson(vehiclePO.getShiftTimeUp56()));

        vehiclePO.setShiftTimeDown12Json(JsonUtil.listToJson(vehiclePO.getShiftTimeDown12()));
        vehiclePO.setShiftTimeDown23Json(JsonUtil.listToJson(vehiclePO.getShiftTimeDown23()));
        vehiclePO.setShiftTimeDown34Json(JsonUtil.listToJson(vehiclePO.getShiftTimeDown34()));
        vehiclePO.setShiftTimeDown45Json(JsonUtil.listToJson(vehiclePO.getShiftTimeDown45()));
        vehiclePO.setShiftTimeDown56Json(JsonUtil.listToJson(vehiclePO.getShiftTimeDown56()));

        vehiclePO.setRelationCurveRightWheelAngleAndSteeringGearOutputJson(JsonUtil.listToJson(vehiclePO.getRelationCurveRightWheelAngleAndSteeringGearOutput()));
        vehiclePO.setRelationCurveLeftWheelAngleAndSteeringGearOutputJson(JsonUtil.listToJson(vehiclePO.getRelationCurveLeftWheelAngleAndSteeringGearOutput()));
    }


    public static void jsonToList(VehicleVO vehicleVO) {
        vehicleVO.setFrontLeftWheelRelationCurvePositiveMomentAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getFrontLeftWheelRelationCurvePositiveMomentAndSideslipAngleJson()));
        vehicleVO.setFrontLeftWheelRelationCurveLateralForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getFrontLeftWheelRelationCurveLateralForceAndSideslipAngleJson()));
        vehicleVO.setFrontLeftWheelRelationCurveLongitudinalForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getFrontLeftWheelRelationCurveLongitudinalForceAndSideslipAngleJson()));

        vehicleVO.setRearLeftWheelRelationCurvePositiveMomentAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getRearLeftWheelRelationCurvePositiveMomentAndSideslipAngleJson()));
        vehicleVO.setRearLeftWheelRelationCurveLateralForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getRearLeftWheelRelationCurveLateralForceAndSideslipAngleJson()));
        vehicleVO.setRearLeftWheelRelationCurveLongitudinalForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getRearLeftWheelRelationCurveLongitudinalForceAndSideslipAngleJson()));

        vehicleVO.setFrontRightWheelRelationCurvePositiveMomentAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getFrontRightWheelRelationCurvePositiveMomentAndSideslipAngleJson()));
        vehicleVO.setFrontRightWheelRelationCurveLateralForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getFrontRightWheelRelationCurveLateralForceAndSideslipAngleJson()));
        vehicleVO.setFrontRightWheelRelationCurveLongitudinalForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getFrontRightWheelRelationCurveLongitudinalForceAndSideslipAngleJson()));

        vehicleVO.setRearRightWheelRelationCurvePositiveMomentAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getRearRightWheelRelationCurvePositiveMomentAndSideslipAngleJson()));
        vehicleVO.setRearRightWheelRelationCurveLateralForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getRearRightWheelRelationCurveLateralForceAndSideslipAngleJson()));
        vehicleVO.setRearRightWheelRelationCurveLongitudinalForceAndSideslipAngle(JsonUtil.jsonToCommonList(vehicleVO.getRearRightWheelRelationCurveLongitudinalForceAndSideslipAngleJson()));

        vehicleVO.setRelationCurveEngineTorqueSpeedAndThrottleOpening(JsonUtil.jsonToCommonList(vehicleVO.getRelationCurveEngineTorqueSpeedAndThrottleOpeningJson()));

        vehicleVO.setGearRatio(JsonUtil.jsonToCommonList(vehicleVO.getGearRatioJson()));
        vehicleVO.setInertia(JsonUtil.jsonToCommonList(vehicleVO.getInertiaJson()));
        vehicleVO.setDriving(JsonUtil.jsonToCommonList(vehicleVO.getDrivingJson()));
        vehicleVO.setCoasting(JsonUtil.jsonToCommonList(vehicleVO.getCoastingJson()));

        vehicleVO.setShiftTimeUp12(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeUp12Json()));
        vehicleVO.setShiftTimeUp23(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeUp23Json()));
        vehicleVO.setShiftTimeUp34(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeUp34Json()));
        vehicleVO.setShiftTimeUp45(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeUp45Json()));
        vehicleVO.setShiftTimeUp56(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeUp56Json()));

        vehicleVO.setShiftTimeDown12(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeDown12Json()));
        vehicleVO.setShiftTimeDown23(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeDown23Json()));
        vehicleVO.setShiftTimeDown34(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeDown34Json()));
        vehicleVO.setShiftTimeDown45(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeDown45Json()));
        vehicleVO.setShiftTimeDown56(JsonUtil.jsonToCommonList(vehicleVO.getShiftTimeDown56Json()));

        vehicleVO.setRelationCurveRightWheelAngleAndSteeringGearOutput(JsonUtil.jsonToCommonList(vehicleVO.getRelationCurveRightWheelAngleAndSteeringGearOutputJson()));
        vehicleVO.setRelationCurveLeftWheelAngleAndSteeringGearOutput(JsonUtil.jsonToCommonList(vehicleVO.getRelationCurveLeftWheelAngleAndSteeringGearOutputJson()));

    }

}
