package org.ta.pddserver.utils;


import com.alibaba.fastjson.JSONObject;

public class JsonResponse {
    public static JSONObject generateOpenCommonSuccessResponse() {
        JSONObject resp = new JSONObject();
        resp.put("success", true);
        return resp;
    }

    public static JSONObject generateOpenCommonFailedResponse(int code, String message) {
        JSONObject resp = new JSONObject();
        resp.put("success", false);
        resp.put("code", code);
        resp.put("message", message);
        return resp;
    }

    public static JSONObject generateLGCommonSuccessResponse(String shipId, Object data) {
        JSONObject resp = new JSONObject();
        resp.put("success", true);
        resp.put("shipId", shipId);
        resp.put("reason_code", "0");
        if (data != null) {
            resp.put("data", data);
        }
        return resp;
    }

    public static JSONObject generateLGCommonFailedResponse(String shipId, String reason_code, String message) {
        JSONObject resp = new JSONObject();
        resp.put("success", false);
        resp.put("shipId", shipId);
        resp.put("reason_code", reason_code);
        resp.put("message", message);
        return resp;
    }

    public static JSONObject generateLocalCommonSuccessResponse(Object data, String message) {
        JSONObject resp = new JSONObject();
        resp.put("success", true);
        resp.put("reason_code", "0");
        resp.put("message", message);
        if (data != null) {
            resp.put("data", data);
        }
        return resp;
    }

    public static JSONObject generateLocalCommonFailedResponse(String reason_code, String message) {
        JSONObject resp = new JSONObject();
        resp.put("success", false);
        resp.put("reason_code", reason_code);
        resp.put("message", message);
        return resp;
    }
}
