package com.ghy.order.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
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;

    private String orderStatusName;

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

    // 接单师傅
    private Worker worker;

    private String orderImgs;

    @Excel(name = "交货图片", cellType = Excel.ColumnType.STRING)
    private String handoverImages;

    @Excel(name = "交货备注", cellType = Excel.ColumnType.STRING)
    private String handoverRemark;

    @Excel(name = "进入确认中时间", cellType = Excel.ColumnType.STRING)
    private Date confirmStartTime;

    /**
     * 确认中倒计时剩余时间（毫秒）- 售后暂停时记录
     */
    private Long confirmTimeoutRemainingTime;

    // 商品归属师傅
    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 String consoleGoodsName;
    private String lastCallTime;
    private String mixExpectTime;

    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;

    /**
     *  售后是否超时 1=是 0=否
     * */
    private Integer afterTimeout;

    /**
     * 查询时是否包含售后超时条件
     */
    private Boolean includeAfterTimeout;

    /**
     * 超时扣款次数
     */
    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;

    private String isCall;

    /**
     * 延期次数，最大2次
     */
    private Integer delayCount;

    /**
     * 退单原因
     */
    private String returnReason;

    /**
     * 退单原因详情
     */
    private String returnReasonDetail;

    /**
     * 退单图片
     */
    private String returnImages;

    /**
     * 师傅备注
     */
    private String workerRemark;

    /**
     * 售后状态：0-无售后，1-售后纠纷
     */
    @Excel(name = "售后状态：0-无售后，1-售后纠纷，2-售后已完成，3-售后已取消")
    private Integer afterServiceStatus;

    /**
     * 分账倒计时结束时间
     */
    @Excel(name = "分账倒计时结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date shareAccountCountdownEndTime;

    /**
     * 分账倒计时时长（小时）
     */
    @Excel(name = "分账倒计时时长（小时）")
    private Integer shareAccountCountdownDuration;

    /**
     * 发货类型 - 订单的发货方式
     */
    @Excel(name = "发货类型")
    private Integer deliveryType;

    /**
     * 发货备注 - 发货相关备注信息
     */
    @Excel(name = "发货备注")
    private String deliveryRemark;

    /**
     * 发货图片 - 发货凭证图片
     */
    @Excel(name = "发货图片")
    private String deliveryImages;

    /**
     * 快递单号 - 物流跟踪单号
     */
    @Excel(name = "快递单号")
    private String trackingNumber;

    /**
     * 订单图片 - 客户下单时上传的图片
     */
    @Excel(name = "订单图片")
    private String orderImages;

       //是否立即发货
    private  Integer isQuicklyDelivery;
}
