package com.prolog.eis.dto.result;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiModelProperty;

import java.io.IOException;
import java.io.Serializable;
import java.util.List;

/**
 * @Author wangkang
 * @Description
 * @CreateTime 2021/7/5 10:20
 */
public class WmsResult<T> implements Serializable {


    @ApiModelProperty(value = "消息对象")
    private String message;
    @ApiModelProperty(value = "状态")
    private String status;
    @ApiModelProperty(value = "入库托盘号")
    private String instruction_no;
    @ApiModelProperty(value = "出库托盘号")
    private String shuttle_instruction_no;
    @ApiModelProperty(value = "商品编码")
    private String sku_no;

    public WmsResult() {
    }

    @Override
    public String toString() {
        return "WmsResult{" +
                ", message='" + message + '\'' +
                ", status='" + status + '\'' +
                ", instruction_no='" + instruction_no + '\'' +
                ", shuttle_instruction_no='" + shuttle_instruction_no + '\'' +
                ", sku_no='" + sku_no + '\'' +
                '}';
    }

    public static <T> WmsResult<T> success(String message, String instruction_no, String shuttle_instruction_no,String sku_no) {
        return new WmsResult<T>(message,instruction_no,shuttle_instruction_no,sku_no);
    }

    public static <T> WmsResult<T> error(String message, String instruction_no, String shuttle_instruction_no,String sku_no) {
        return new WmsResult<T>("499", message,instruction_no,shuttle_instruction_no,sku_no);
    }

    public WmsResult(String message, String instruction_no, String shuttle_instruction_no,String sku_no) {
        this.message = message;
        this.status = "200";
        this.instruction_no = instruction_no;
        this.shuttle_instruction_no = shuttle_instruction_no;
        this.sku_no = sku_no;
    }

    public WmsResult(String status, String message, String instruction_no, String shuttle_instruction_no,String sku_no) {
        this.message = message;
        this.status = status;
        this.instruction_no = instruction_no;
        this.shuttle_instruction_no = shuttle_instruction_no;
        this.sku_no = sku_no;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getSku_no() {
        return sku_no;
    }

    public void setSku_no(String sku_no) {
        this.sku_no = sku_no;
    }

    public String getInstruction_no() {
        return instruction_no;
    }

    public void setInstruction_no(String instruction_no) {
        this.instruction_no = instruction_no;
    }

    public String getShuttle_instruction_no() {
        return shuttle_instruction_no;
    }

    public void setShuttle_instruction_no(String shuttle_instruction_no) {
        this.shuttle_instruction_no = shuttle_instruction_no;
    }

    public boolean isSuccess(){
        return this.status.equals("200");
    }
}
