package com.ghy.order.domain;

import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import com.ghy.common.enums.OrderStatus;
import com.ghy.common.enums.PayStatus;
import com.ghy.common.enums.PayTypeEnum;
import com.ghy.goods.domain.Goods;
import com.ghy.worker.domain.Worker;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @author clunt
 * 细单表(转派后产生的订单)
 */
@Data
public class OrderDetail extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC)
    private Long id;

    @Excel(name = "商户ID", cellType = Excel.ColumnType.NUMERIC)
    private Long deptId;

    @Excel(name = "订单编码", cellType = Excel.ColumnType.STRING)
    private String code;

    @Excel(name = "主单id", cellType = Excel.ColumnType.NUMERIC)
    private Long orderMasterId;

    @Excel(name = "主单编码", cellType = Excel.ColumnType.STRING)
    private String orderMasterCode;

    @Excel(name = "消费者用户id", cellType = Excel.ColumnType.NUMERIC)
    private Long customerId;

    @Excel(name = "消费者", cellType = Excel.ColumnType.STRING)
    private String customerName;

    @Excel(name = "消费者电话", cellType = Excel.ColumnType.STRING)
    private String customerPhone;

    private String addressPhone;

    private String addressName;

    private String address;

    @Excel(name = "订单类型", cellType = Excel.ColumnType.NUMERIC)
    private Integer orderType;

    /**
     * @see OrderStatus
     */
    @Excel(name = "订单状态", cellType = Excel.ColumnType.NUMERIC)
    private Integer orderStatus;

    @Excel(name = "接单师傅id", cellType = Excel.ColumnType.NUMERIC)
    private Long workerId;

    // 接单师傅
    private Worker worker;
    // 商品归属师傅
    private Worker goodsWorker;

    @Excel(name = "接单时间", cellType = Excel.ColumnType.STRING)
    private Date revTime;

    private Date expectTimeStart;

    private Date expectTimeEnd;

    @Excel(name = "服务开始时间/上门时间", cellType = Excel.ColumnType.STRING)
    private Date workBeginTime;

    @Excel(name = "服务完成时间", cellType = Excel.ColumnType.STRING)
    private Date workFinishTime;

    private String clockInLocation;

    private Date createTime;

    private Long goodsCategoryId;

    private Goods goods;
    private String goodsName;

    private Long countryId;

    private Boolean isOverTime;

    private List<AfterServiceRecord> afterServiceRecordList;

    private String orderDetailIds;

    private Boolean useTimeNotRange;

    private Integer shelveStatus;

    private Integer ledgerAccountStatus;

    private Integer sysPayStatus;

    /**
     * 发起提现后Adapay返回的对象ID draw_cash_id
     */
    private String drawCashId;

    /**
     * draw_cash_status
     * 0 未分账
     * 1 已分账
     * 2 已到账
     * -1 提现失败
     */
    private Integer drawCashStatus;

    private List<Integer> drawCashStatusList;

    /**
     * 发起提现时间 draw_cash_time
     */
    private Date drawCashTime;
    /**
     * 提现到账时间 arrival_time
     */
    private Date arrivalTime;

    /**
     * @see PayTypeEnum
     */
    @Excel(name = "付款类型", cellType = Excel.ColumnType.NUMERIC)
    private Integer payType;

    /**
     * @see PayStatus
     */
    @Excel(name = "付款状态", cellType = Excel.ColumnType.NUMERIC)
    private Integer payStatus;

    @Excel(name = "付款时间", cellType = Excel.ColumnType.STRING)
    private Date payTime;

    private BigDecimal financialMasterMoney;
    private BigDecimal financialDetailMoney;
    private BigDecimal changeMoney;

    private boolean workFinishTimeExisted;

    private List<Integer> orderStatusList;

    /**
     * 是否超时 1=是 0=否
     */
    private Integer timeout;

    /**
     * 超时扣款次数
     */
    private Integer timeoutFineTimes;

    private String storeName;

    private String storePhone;

    private String workerName;

    private String workerPhone;

    private String keyWords;

    private List<Long> workerIds;

    private List<Long> masterIds;

    private Boolean searchAfterList;

    private Date workBeginTimeStart;

    private Date workBeginTimeEnd;

    private Date workFinishTimeStart;

    private Date workFinishTimeEnd;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTimeStart;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTimeEnd;

    private Boolean needImgs;
}
