package cn.estsh.i3plus.pojo.model.wms;

import cn.estsh.i3plus.pojo.wms.bean.WmsOptionModel;
import cn.estsh.i3plus.pojo.wms.bean.WmsTransType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description : PDA传输到后台的实体bean对象
 * @Reference :
 * @Author : silliter.yuan
 * @CreateDate : 2018-11-22 15:58
 * @Modify:
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Api("返回前端数据实体")
public class WmsActionResponseBean<Obj> implements Serializable {

    private static final long serialVersionUID = 201974065997991407L;
    @ApiParam("回显BARCODE值")
    public Map<String, Obj> barCode;

    @ApiParam("进度")
    public String percent = "消息提示：";

    @ApiParam("当前步骤类型名称")
    public String currentStepTypeName;

    @ApiParam("当前步骤名称")
    public String currentStepName;

    @ApiParam("总步数")
    public int totalStep;

    @ApiParam("错误提示信息")
    public String errorMsg;

    @ApiParam("提示信息")
    public String message = "";

    @ApiParam("列表信息")
    public List<WmsMessageStyleModel> informations;

    @ApiParam("可选项")
    public List<WmsOptionModel> options;

    public List<WmsOptionModel> getOptions() {
        if (options == null) {
            options = new ArrayList<>();
        }
        return options;
    }

    public void setOptions(List<WmsOptionModel> opt) {
        if (opt == null) {
            opt = new ArrayList<>();
        }
        options = opt;
    }

    @ApiParam("选中的明细数据")
    public Obj details;

    @ApiParam(value = "结果代码")
    public Boolean codeStatus = true;

    @ApiParam(value = "作业任务编号", example = "1")
    @JsonSerialize(using = ToStringSerializer.class)
    public Long alId;

    /**
     * 默认为False，如果这个值为True，
     * 就把detailsData的内容以List的格式显示到 列表提示区域
     */
    @ApiParam(value = "是否需要选择单号")
    public Boolean toSelected = false;
    /**
     * 与 toSelected 属性配合使用，
     * 选择数据后把选中行的 keyColumn 字段的值写入界面输入框并触发回车事件
     */
    @ApiParam(value = "关键字段列名")
    public String keyColumn;
    /**
     * 默认为true，如果这个值为true就禁用按钮否则可用，
     */
    @ApiParam(value = "输入框是否禁用")
    public Boolean isInputBtnDisabled = false;

    @ApiParam(value = "交易类型信息")
    public WmsTransType wmsTransType;

    @ApiParam(value = "是否自动开窗")
    public Boolean isAutoOpenWindow = false;

    @ApiParam(value = "正则校验")
    private String regularCheck;

    @ApiParam(value = "正则校验失败提示")
    private String regularCheckFailMsg;

    @ApiParam(value = "搜索KEY")
    public String searchKey;

    @ApiParam(value = "分组KEY")
    public String groupKey;

    @ApiParam(value = "工厂代码")
    private String organizeCode;

    @ApiParam(value = "提交模式")
    private Integer commitMode;

    @ApiParam(value = "是否允许重置")
    private Integer isResetAble;

    public WmsActionResponseBean(Boolean codeStatus, String message) {
        this.codeStatus = codeStatus;
        this.message = message;
    }

    public WmsActionResponseBean(String percent, String message, List<WmsMessageStyleModel> informations, Obj details, Boolean codeStatus, Map<String, Obj> barCode) {
        this.percent = percent;
        this.message = message;
        this.informations = informations;
        this.details = details;
        this.codeStatus = codeStatus;
        this.barCode = barCode;
    }

    public WmsActionResponseBean(String percent, String message, List<WmsMessageStyleModel> informations, Obj details, Boolean codeStatus) {
        this.percent = percent;
        this.message = message;
        this.informations = informations;
        this.details = details;
        this.codeStatus = codeStatus;
    }

    public WmsActionResponseBean(String percent, String message, List<WmsMessageStyleModel> informations, Obj details, Boolean codeStatus, Boolean isBtnDisabled) {
        this.percent = percent;
        this.message = message;
        this.informations = informations;
        this.details = details;
        this.codeStatus = codeStatus;
    }

}
