/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package vip.xiaonuo.biz.modular.depotWorkAlarm.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import vip.xiaonuo.biz.core.Const.BizStr;
import vip.xiaonuo.biz.modular.depotTruckBook.entity.DepotTruckBook;

import javax.validation.constraints.NotBlank;

/**
 * 出入库异常添加参数
 *
 * @author xiang
 * @date  2023/09/18 11:09
 **/
@Getter
@Setter
public class DepotWorkAlarmAddParam {

    /** 项目编码 */
    @ApiModelProperty(value = "项目编码", required = true, position = 2)
    @NotBlank(message = "depotId不能为空")
    private String depotId;

    /** 预约ID */
    @ApiModelProperty(value = "预约ID", position = 3)
    private String truckBookId;

    /** 出入库id */
    @ApiModelProperty(value = "出入库id", position = 3)
    private String depotWorkId;

    /** 出入库:入库/出库 */
    @ApiModelProperty(value = "出入库:入库/出库", required = true, position = 4)
    @NotBlank(message = "depotBizType不能为空")
    private String depotBizType;

    /** 车牌 */
    @ApiModelProperty(value = "车牌", position = 5)
    private String licensePlate;

    /** 异常分类 */
    @ApiModelProperty(value = "异常分类", position = 6)
    private String alarmType;

    /** 进程分类
     * 入库 车辆离开门禁区到达扦样区校验超时时间       预警类型  1
     * 入库 车辆离开扦样区到达称重区进行一次过磅称重   预警类型  2
     * 入库 车辆离开库房装卸区到达称重区进行二次过磅称重   预警类型  3
     * 入库 系统校验皮重。净重或者校验是否存在一致重量(上下阈值)  预警类型  4
     * 出库 车辆进行一次过磅称重   预警类型  5
     */
    @ApiModelProperty(value = "进程分类", position = 6)
    private String flowType;

    /** 处理状态 */
    @ApiModelProperty(value = "处理状态", position = 7)
    private String saveState = BizStr.STATE_PROCESS_N;

    /** 异常信息 */
    @ApiModelProperty(value = "异常信息", position = 8)
    private String alarmMsg;

    /** 异常原因 */
    @ApiModelProperty(value = "异常原因", position = 9)
    private String alarmCause;

    public DepotWorkAlarmAddParam() {
    }

    public DepotWorkAlarmAddParam(String truckBookId, String flowType, String alarmMsg) {
        this.truckBookId = truckBookId;
        this.flowType = flowType;
        this.alarmMsg = alarmMsg;
    }

    /**
     * 报警
     */
    public DepotWorkAlarmAddParam asByBook(DepotTruckBook book) {
        this.depotId = book.getDepotId();
        this.depotBizType = book.getDepotBizType();
        this.licensePlate = book.getLicensePlate();
        this.alarmType = BizStr.ALARM_TYPE_Y;
        this.saveState = BizStr.STATE_PROCESS_N;
        return this;
    }

    /**
     * 待处理异常
     */
    public DepotWorkAlarmAddParam(String depotId, String truckBookId, String depotWorkId, String depotBizType, String licensePlate, String alarmMsg, String alarmCause) {
        this.depotId = depotId;
        this.truckBookId = truckBookId;
        this.depotWorkId = depotWorkId;
        this.depotBizType = depotBizType;
        this.licensePlate = licensePlate;
        this.alarmType = "异常";
        this.saveState = BizStr.STATE_PROCESS_N;
        this.alarmMsg = alarmMsg;
        this.alarmCause = alarmCause;
    }
}
