package com.cyl.manager.staff.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.cyl.h5.pojo.vo.H5OrderVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseAudit;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 派单信息
 * </p>
 *
 * @author 谷瑶
 * @since 2025-01-04
 */
@TableName(value = "dispatch_order",autoResultMap = true)
@ApiModel(value = "DispatchOrder对象", description = "派单信息")
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DispatchOrder extends BaseAudit {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("派单id")
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty("订单id")
    @TableField("order_id")
    private Long orderId;

    @ApiModelProperty("伴宠师id")
    @TableField("staff_id")
    private Long staffId;

    @ApiModelProperty("派单类型 1系统派单 2个人订单")
    @TableField("dispatched_type")
    private Integer dispatchedType;

    @ApiModelProperty("派单状态 1待接单，2已接单，3已流失")
    @TableField("dispatched_status")
    private Integer dispatchedStatus;

    @ApiModelProperty("服务地址")
    @TableField("service_address")
    private String serviceAddress;

    @ApiModelProperty("服务距离")
    @TableField("service_distance")
    private Integer serviceDistance;

    @ApiModelProperty("报酬")
    @TableField("reward")
    private BigDecimal reward;

    @ApiModelProperty("订单实体")
    @TableField(value = "order_info", typeHandler = FastjsonTypeHandler.class)
    private H5OrderVO orderInfo;

    @ApiModelProperty("删除标识")
    @TableField("del_flag")
    private Boolean delFlag;

    /**
     * 发布时间
     */
    @ApiModelProperty("发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("dispatch_time")
    private LocalDateTime dispatchTime;

    /**
     * 接单时间
     */
    @ApiModelProperty("接单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("accept_time")
    private LocalDateTime acceptTime;
}
