package com.storlead.sales.pojo.entity.customer;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.storlead.framework.annotate.AnnotateEnumType;
import com.storlead.framework.annotate.Dict;
import com.storlead.framework.annotate.OrgAutoMateAnnotate;
import com.storlead.framework.mybatis.entity.SysBaseField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 客户基本信息表
 * </p>
 *
 * @author YPZ
 * @since 2024-04-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("customer")
@ApiModel(value="CustomerEntity对象", description="客户基本信息表")
public class CustomerEntity extends SysBaseField {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "客户主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "编码")
    @TableField(value = "data_code")
    private String dataCode;

    @ApiModelProperty(value = "客户种类（10客户、11线索）")
    @TableField("customer_form")
    private Integer customerForm;

    @ApiModelProperty(value = "是否从线索过来（0否，1是）")
    @TableField("has_from_clue")
    private Boolean hasFromClue;

    @ApiModelProperty(value = "是否是公共线索/公海客户（0不是，1是）")
    @TableField("has_public_customer")
    private Boolean hasPublicCustomer;

    @ApiModelProperty(value = "是否是垃圾客户（0不是，1是）")
    @TableField("has_garbage_customer")
    private Boolean hasGarbageCustomer;

    @ApiModelProperty(value = "是否是重点关注（0不是，1是）")
    @TableField("has_follow_customer")
    private Boolean hasFollowCustomer;

    @ApiModelProperty(value = "客户代码")
    @TableField("customer_code")
    private String customerCode;

    @ApiModelProperty(value = "所属大洲（区域）")
    @TableField("continent")
    private String continent;

    @ApiModelProperty(value = "所属国家（区域）")
    @TableField("country")
    private String country;

//    @ApiModelProperty(value = "归属人员姓名")
//    @TableField("owner_name")
//    private String ownerName;

    @ApiModelProperty(value = "客户名称")
    @TableField("customer_name")
    private String customerName;

    @ApiModelProperty(value = "意向产品id，逗号隔开（产品来源：官网后台）")
    @TableField("intended_products_ids")
    @Dict(dictCode = "intended_products_type",valueField = "intendedProductsNames")
    private String intendedProductsIds;

    @ApiModelProperty(value = "意向产品名称，逗号隔开（产品来源：官网后台）")
    @TableField("intended_products_names")
    private String intendedProductsNames;

    @ApiModelProperty(value = "线索状态value（对应字典线索状态value）")
    @TableField("clue_status_dict_value")
    @Dict(dictCode = "clue_status")
    private String clueStatusDictValue;

    @ApiModelProperty(value = "客户状态value（对应字典客户状态value）")
    @TableField("customer_status_dict_value")
    private String customerStatusDictValue;

    @ApiModelProperty(value = "客户来源value（对应字典客户来源value）")
    @TableField("customer_source_dict_value")
    private String customerSourceDictValue;

    @ApiModelProperty(value = "客户类型value（对应字典客户类型value）")
    @TableField("customer_type_dict_value")
    private String customerTypeDictValue;

    @ApiModelProperty(value = "代理合作客户id")
    @TableField("cooperative_customer_id")
    private Long cooperativeCustomerId;

    @ApiModelProperty(value = "客户等级value（对应字典客户等级value）")
    @TableField("customer_level_dict_value")
    private String customerLevelDictValue;

    @ApiModelProperty(value = "客户信用等级value（对应字典客户信用等级value）")
    @TableField("customer_credit_level_dict_value")
    private String customerCreditLevelDictValue;

    @ApiModelProperty(value = "客户经济性质value（对应字典客户经济性质value）")
    @TableField("customer_economic_nature_dict_value")
    private String customerEconomicNatureDictValue;

    @ApiModelProperty(value = "助记名称")
    @TableField("mnemonic_name")
    private String mnemonicName;

    @ApiModelProperty(value = "备注信息")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "开户行")
    @TableField("opening_bank")
    private String openingBank;

    @ApiModelProperty(value = "税号")
    @TableField("tax_number")
    private String taxNumber;

    @ApiModelProperty(value = "银行账号")
    @TableField("bank_account")
    private String bankAccount;

    @ApiModelProperty(value = "置公原因value（对应字典置公原因value）")
    @TableField("reason_public_customer_dict_value")
    private String reasonPublicCustomerDictValue;

    @ApiModelProperty(value = "是否有订单（成交客户，0没有，1有）")
    @TableField("has_order_form")
    private Integer hasOrderForm;

    @ApiModelProperty(value = "最后跟进时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("last_follow_up_time")
    private LocalDateTime lastFollowUpTime;

    @ApiModelProperty(value = "未跟进天数")
    @TableField("no_follow_up_date")
    private Integer noFollowUpDate;

    @ApiModelProperty(value = "置公日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @TableField("public_date")
    private Date publicDate;

    @ApiModelProperty(value = "置公提醒日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @TableField("public_remind_date")
    private Date publicRemindDate;

    @ApiModelProperty(value = "转垃圾客户日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @TableField("garbage_date")
    private Date garbageDate;

    @ApiModelProperty(value = "转垃圾客户提醒日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @TableField("garbage_remind_date")
    private Date garbageRemindDate;

    @ApiModelProperty(value = "清除日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @TableField("delete_date")
    private Date deleteDate;

    @ApiModelProperty(value = "清除预警日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @TableField("delete_remind_date")
    private Date deleteRemindDate;

    @ApiModelProperty(value = "客户归属时间（1、领取或分配 - 领取时间或者被分配时间。2、创建或转客户-创建时间或转客户时间）")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("owner_time")
    private LocalDateTime ownerTime;

    @ApiModelProperty(value = "放弃时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @TableField("give_up_time")
    private LocalDateTime giveUpTime;

    @ApiModelProperty(value = "协作人员id,逗号分割")
    @TableField("collaborator")
    private String collaborator;

    @ApiModelProperty(value = "前归属人")
    @OrgAutoMateAnnotate(valueField = "formerOwnerByName",annotateType = AnnotateEnumType.USER)
    private Long formerOwnerBy;

    @ApiModelProperty(value = "归属人姓名")
    @TableField(exist = false)
    private String ownerByName;
}
