package com.sckw.transport.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.sckw.core.model.page.PageRequest;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.Date;
import java.util.List;

/**
 * @author zk
 * @desc 运单查询参数
 * @date 2024/3/8 0008
 */
@Data
public class WaybillOrderQueryDto extends PageRequest{

    private String ids;

    /**
     * 企业ID
     */
    private Long  entId;

    /**
     * 多企业ID
     */
    private List<Long> entIds;

    /**
     * 关键字搜索
     */
    private String keywords;

    /**
     * 派车开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startSendCarTime;

    /**
     * 派车结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endSendCarTime;


    /**
     * 装载开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startLoadTime;

    /**
     * 装载结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endLoadTime;

    /**
     * 卸载开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startUnloadTime;

    /**
     * 卸载结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endUnloadTime;

    /**
     * 装载城市
     */
    private String loadCityCode;

    /**
     * 装载城市查询等级
     */
    private Integer loadCityCodeLevel;

    /**
     * 卸载城市
     */
    private String unloadCityCode;

    /**
     * 卸载城市查询等级
     */
    private Integer unloadCityCodeLevel;

    /**
     * 运单状态
     */
    @JsonProperty("status")
    //@NotNull(message = "订单状态不能为空")
    private Integer status;

    /**
     * 界面状态匹配实际业务状态
     */
    private String queryWstatus;

    /**
     * 用户ID
     */
    private List<Long> userIds;

    private String lOrderId;

    public void setLoadCityCodeLevel(Integer loadCityCodeLevel) {
        this.loadCityCodeLevel = loadCityCodeLevel != null && loadCityCodeLevel == 3 ? 0 : loadCityCodeLevel == 2 ? 4 : 2;
    }

    public void setUnloadCityCodeLevel(Integer unloadCityCodeLevel) {
        this.unloadCityCodeLevel = unloadCityCodeLevel != null && unloadCityCodeLevel == 3 ? 0 : unloadCityCodeLevel == 2 ? 4 : 2;
    }
}
