package com.gxwebsoft.cms.entity;

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

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

/**
 * 联系表单/销售线索
 *
 * @author 科技小王子
 * @since 2026-03-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "CmsContactLead对象", description = "联系表单/销售线索")
public class CmsContactLead implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "线索ID")
    @TableId(value = "lead_id", type = IdType.AUTO)
    private Integer leadId;

    @Schema(description = "联系人姓名")
    private String name;

    @Schema(description = "手机号")
    private String phone;

    @Schema(description = "单位/公司名称")
    private String company;

    @Schema(description = "交付方式: saas/private/hybrid")
    private String delivery;

    @Schema(description = "需求描述")
    private String need;

    @Schema(description = "来源渠道: web/miniapp/app")
    private String source;

    @Schema(description = "提交IP")
    private String ip;

    @Schema(description = "跟进状态: 0待跟进 1跟进中 2已成交 3无效")
    private Integer status;

    @Schema(description = "销售备注")
    private String remarks;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户ID")
    private Integer tenantId;

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

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    public String getStatusText() {
        if (this.status == null) return "";
        return switch (this.status) {
            case 0 -> "待跟进";
            case 1 -> "跟进中";
            case 2 -> "已成交";
            case 3 -> "无效";
            default -> "";
        };
    }
}
