package org.hzhub.crm.domain.bo;

import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hzhub.common.core.xss.Xss;
import org.hzhub.common.mybatis.core.domain.BaseEntity;
import org.hzhub.crm.domain.CrmDealer;

import java.math.BigDecimal;

/**
 * CRM经销商业务对象 crm_dealer
 *
 * @author hzhub
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = CrmDealer.class, reverseConvertGenerate = false)
public class CrmDealerBo extends BaseEntity {

    /**
     * 经销商ID
     */
    private Long dealerId;

    /**
     * ERP客户编码（可选）
     */
    private String customerCode;

    /**
     * 经销商名称
     */
    @Xss(message = "经销商名称不能包含脚本字符")
    @NotBlank(message = "经销商名称不能为空")
    @Size(min = 0, max = 200, message = "经销商名称长度不能超过{max}个字符")
    private String dealerName;

    /**
     * 经销商编码
     */
    @NotBlank(message = "经销商编码不能为空")
    @Size(min = 0, max = 100, message = "经销商编码长度不能超过{max}个字符")
    private String dealerCode;

    /**
     * 联系人
     */
    @Xss(message = "联系人不能包含脚本字符")
    @Size(min = 0, max = 100, message = "联系人长度不能超过{max}个字符")
    private String contactName;

    /**
     * 手机号
     */
    @Size(min = 0, max = 50, message = "手机号长度不能超过{max}个字符")
    private String mobile;

    /**
     * 省
     */
    @Size(min = 0, max = 50, message = "省份长度不能超过{max}个字符")
    private String province;

    /**
     * 市
     */
    @Size(min = 0, max = 50, message = "城市长度不能超过{max}个字符")
    private String city;

    /**
     * 经销商等级（字典：crm_dealer_level）
     */
    private String level;

    /**
     * 生命周期（字典：crm_lifecycle）
     */
    private String lifecycle;

    /**
     * 签约时间
     */
    private String signedAt;

    /**
     * 门店数
     */
    private Integer storeCount;

    /**
     * 团队规模
     */
    private Integer teamSize;

    /**
     * 累计订单金额
     */
    private BigDecimal totalOrderAmount;

    /**
     * 累计回款金额
     */
    private BigDecimal totalPaymentAmount;

    /**
     * 活跃评分
     */
    private BigDecimal activityScore;

    /**
     * 风险评分
     */
    private BigDecimal riskScore;

    /**
     * 负责人（关联 sys_user）
     */
    private Long ownerUserId;

    /**
     * 来源线索ID
     */
    private Long sourceLeadId;

    public CrmDealerBo(Long dealerId) {
        this.dealerId = dealerId;
    }
}