package com.seeyon.apps.ydctu8c.vo;

import com.alibaba.fastjson.JSONObject;

/**
 * 功能描述:<br>
 * <pre>
 *
 * </pre>
 *
 * @Author: HuangZhengguo
 * @Date: 2024/4/28
 */
public class U8cResponse {

    private boolean success;
    private int status;
    private String msg;
    private String data;


    public U8cResponse(JSONObject object) {
        if(object.containsKey("Status")) {
            this.status = object.getInteger("Status");
        } else {
            this.status = object.getString("status").equals("success")?1:2;
        }
        this.success = (1 == status);
        if(object.containsKey("Msg")) {
            this.msg = object.getString("Msg");
        } else {
            this.msg = object.getString("errormsg");
        }
        if(object.containsKey("Data")) {
            this.data = object.getString("Data");
        } else {
            this.data = object.getString("data");
        }
    }

    public boolean isSuccess() {
        return success;
    }

    public U8cResponse setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public int getStatus() {
        return status;
    }

    public U8cResponse setStatus(int status) {
        this.status = status;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public U8cResponse setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public String getData() {
        return data;
    }

    public U8cResponse setData(String data) {
        this.data = data;
        return this;
    }
}
