package com.gxwebsoft.cms.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 客资派单记录实体
 *
 * @author 科技小王子
 * @since 2026-04-14
 */
@Data
@TableName("lead_dispatch")
@Schema(name = "LeadDispatch", description = "客资派单记录")
public class LeadDispatch implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "派单ID")
    @TableId(type = IdType.AUTO)
    private Integer dispatchId;

    @Schema(description = "客资ID")
    private Integer leadId;

    @Schema(description = "原分配用户ID")
    private Integer fromUserId;

    @Schema(description = "新分配用户ID(业务员)")
    private Integer toUserId;

    @Schema(description = "执行派单的管理员ID")
    private Integer adminId;

    @Schema(description = "派单备注")
    private String dispatchRemarks;

    @Schema(description = "派单类型: 1新分配 2重新分配 3抢单")
    private Integer dispatchType;

    @Schema(description = "派单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    // ========== 关联信息（非数据库字段）==========
    @Schema(description = "业务员昵称")
    private String toUserName;

    @Schema(description = "管理员昵称")
    private String adminName;

    @Schema(description = "客资客户姓名")
    private String leadCustomerName;

    @Schema(description = "客资客户电话")
    private String leadCustomerPhone;

    // ========== 派单类型常量 ==========
    public static final int TYPE_NEW = 1;      // 新分配
    public static final int TYPE_REDISPATCH = 2;  // 重新分配
    public static final int TYPE_GRAB = 3;    // 抢单
}
