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

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableName;
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 java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.storlead.sales.enums.ResourceTypeEnum;
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;

/**
 * <p>
 * 联系人表
 * </p>
 *
 * @author YPZ
 * @since 2024-04-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("liaison")
@ApiModel(value="LiaisonEntity对象", description="联系人表")
public class LiaisonEntity extends SysBaseField {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "联系人id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "关联客户id")
    @TableField("customer_id")
    private Long customerId;

    @ApiModelProperty(value = "是否是首要联系人（0不是，1是）")
    @TableField("has_primary_lialison")
    private Boolean hasPrimaryLialison;

    @ApiModelProperty(value = "联系人姓名")
    @TableField("`name`")
    private String name;

    @ApiModelProperty(value = "尊称（0未知，1先生，2女士）")
    @TableField("`call`")
    @Dict(dictCode = "call_dict_value",valueField = "callName")
    private Integer call;

    @ApiModelProperty(value = "尊称（0未知，1先生，2女士）")
    @TableField(exist = false)
    private String callName;

    @ApiModelProperty(value = "联系人角色value（对应字典联系人角色value）")
    @TableField("liaison_role_dict_value")
    @Dict(dictCode = "liaison_role",valueField = "liaisonRoleName")
    private String liaisonRoleDictValue;

    @ApiModelProperty(value = "联系人角色name（对应字典联系人角色name）")
    //数据库不存在该字段
    @TableField(exist = false)
    private String liaisonRoleName;

    @ApiModelProperty(value = "生日")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format ="yyyy-MM-dd")
    @TableField("birthday")
    private Date birthday;

    @ApiModelProperty(value = "部门职务")
    @TableField("department_position")
    private String departmentPosition;

    @ApiModelProperty(value = "手机号码")
    @TableField("telephone")
    private String telephone;

    @ApiModelProperty(value = "备用邮箱1")
    @TableField("email1")
    private String email1;
    @ApiModelProperty(value = "备用邮箱2")
    @TableField("email2")
    private String email2;
    @ApiModelProperty(value = "备用邮箱3")
    @TableField("email3")
    private String email3;


    @ApiModelProperty(value = "电子邮箱")
    @TableField("email")
    private String email;

//    @ApiModelProperty(value = "商机/订单（1商机，2订单）")
//    @TableField("niche_or_orders")
//    private Integer nicheOrOrders;

    @ApiModelProperty(value = "资源类型")
    @TableField("resource_type")
    private String resourceType;

    @ApiModelProperty(value = "资源类型关联ID")
    @TableField("resource_type_id")
    private Long resourceTypeId;

    @ApiModelProperty(value = "传真号码")
    @TableField("fax_number")
    private String faxNumber;

    @ApiModelProperty(value = "邮政编码")
    @TableField("postcode")
    private String postcode;

    @ApiModelProperty(value = "联系方式")
    @TableField("contact_information")
    private String contactInformation;

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

    @ApiModelProperty(value = "qq")
    @TableField("qq")
    private String qq;

    @ApiModelProperty(value = "skype")
    @TableField("skype")
    private String skype;

    @ApiModelProperty(value = "旺旺")
    @TableField("wangwang")
    private String wangwang;

    @ApiModelProperty(value = "微信")
    @TableField("wechat")
    private String wechat;

    @ApiModelProperty(value = "Twitter")
    @TableField("twitter")
    private String twitter;

    @ApiModelProperty(value = "Linkedin")
    @TableField("linkedin")
    private String linkedin;

    @ApiModelProperty(value = "Facebook")
    @TableField("facebook")
    private String facebook;

    @ApiModelProperty(value = "Whatsapp")
    @TableField("whatsapp")
    private String whatsapp;

    @ApiModelProperty(value = "区域")
    @TableField("international_area")
    private String internationalArea;

    @ApiModelProperty(value = "详细地址")
    @TableField("address")
    private String address;

    @ApiModelProperty(value = "固定电话")
    @TableField("fixed_line_telephone")
    private String fixedLineTelephone;

    @ApiModelProperty(value = "宅电")
    @TableField("home_electricity")
    private String homeElectricity;

    @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 = "前归属人")
    @OrgAutoMateAnnotate(valueField = "formerOwnerByName",annotateType = AnnotateEnumType.USER)
    private Long formerOwnerBy;

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

    @ApiModelProperty(value = "客户名称")
    @TableField(exist = false)
    private String customerName;
    @ApiModelProperty(value = "国家")
    @TableField(exist = false)
    private String country;
    @ApiModelProperty(value = "联系人姓名查询条件")
    @TableField(exist = false)
    private String liaisonName;
}
