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

import java.math.BigDecimal;

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 java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

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-05-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("business")
@ApiModel(value="BusinessEntity对象", description="商机表")
public class BusinessEntity 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 = "商机标题")
    @TableField("title")
    private String title;

    @ApiModelProperty(value = "商机阶段（1初步洽谈、2深入沟通、3产品报价、4成交商机）对应字典business_stage")
    @Dict(dictCode = "business_stage")
    @TableField("stage")
    private String stage;

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

    @ApiModelProperty(value = "主要联系人id")
    @TableField("liaison_id")
    private Long liaisonId;

    @ApiModelProperty(value = "关联报价id")
    @TableField("quotation_id")
    private Long quotationId;

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

    @ApiModelProperty(value = "币种：1-人民币,2-美元")
    @TableField("currency")
    private Integer currency;

    @ApiModelProperty(value = "汇率")
    @TableField("exchange_rate")
    private BigDecimal exchangeRate;

    @ApiModelProperty(value = "原始预计销售金额")
    @TableField("initial_sales_amount")
    private BigDecimal initialSalesAmount;

    @ApiModelProperty(value = "预计销售金额")
    @TableField("estimated_sales_amount")
    private BigDecimal estimatedSalesAmount = BigDecimal.ZERO;

    @ApiModelProperty(value = "预计签单日期")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format ="yyyy-MM-dd")
    @TableField("expected_signing_date")
    private Date expectedSigningDate;

    @ApiModelProperty(value = "签单日期")
    @TableField("signing_date")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format ="yyyy-MM-dd")
    private Date signingDate;

    @ApiModelProperty(value = "销售阶段value（对应字典销售阶段value）")
    @TableField("sales_phase_dict_value")
    private String salesPhaseDictValue;

    @ApiModelProperty(value = "商机类型value（对应字典商机类型value）")
    @TableField("business_type_dict_value")
    private String businessTypeDictValue;

    @ApiModelProperty(value = "成交机率value（对应字典成交机率value）")
    @TableField("transaction_probability_dict_value")
    private String transactionProbabilityDictValue;

    @ApiModelProperty(value = "商机来源value（对应字典商机来源value）")
    @TableField("sources_of_business_dict_value")
    private String sourcesOfBusinessDictValue;

    @ApiModelProperty(value = "获取日期")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format ="yyyy-MM-dd")
    @TableField("geted_date")
    private Date getedDate;

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

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

    @ApiModelProperty(value = "是否是流失商机（0不是，1是）")
    @TableField("has_loss")
    @Dict(dictCode = "has_loss")
    private Integer hasLoss;

    @ApiModelProperty(value = "流失原因（对应字典流失原因value）")
    @TableField("loss_reason_dict_value")
    @Dict(dictCode = "loss_reason")
    private String lossReasonDictValue;

    @ApiModelProperty(value = "流失备注")
    @TableField("loss_remark")
    private String lossRemark;

    @ApiModelProperty(value = "唤醒原因（对应字典唤醒原因value）")
    @TableField("awaken_reason_dict_value")
    @Dict(dictCode = "awaken_reason")
    private String awakenReasonDictValue;

    @ApiModelProperty(value = "唤醒备注")
    @TableField("awaken_remark")
    private String awakenRemark;

}
