package com.shkj.wms.third.ykl;

import com.shkj.common.enums.HttpStatus;

import java.util.HashMap;
import java.util.Map;

public class ThirdYklResult extends HashMap<String, Object> {

    private static final long serialVersionUID = 1L;

    public ThirdYklResult() {
        put("code", 200);
        put("message", "");
        put("success",true);
    }

    public static ThirdYklResult error() {
        return error(HttpStatus.ERROR.getCode(), "未知异常，请联系管理员",false);
    }

    public static ThirdYklResult error(String msg) {
        return error(HttpStatus.ERROR.getCode(), msg,false);
    }

    public static ThirdYklResult error(int code, String msg,Boolean success) {
        ThirdYklResult r = new ThirdYklResult();
        r.put("code", code);
        r.put("message", msg);
        r.put("success",false);
        return r;
    }

    public static ThirdYklResult ok(String msg) {
        ThirdYklResult r = new ThirdYklResult();
        r.put("message", msg);
        return r;
    }

    public static ThirdYklResult ok(Map<String, Object> map) {
        ThirdYklResult r = new ThirdYklResult();
        r.putAll(map);
        return r;
    }

    public static ThirdYklResult ok() {
        return new ThirdYklResult();
    }

    @Override
    public ThirdYklResult put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
