package org.dromara.payment.channel.domain.bo;

import cn.hutool.core.date.DateUtil;
import org.dromara.common.core.utils.DateUtils;
import org.dromara.payment.channel.domain.BusChannel;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 代理商业务对象 bus_channel
 *
 * @author LionLi
 * @date 2024-04-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = BusChannel.class, reverseConvertGenerate = false)
public class BusChannelBo extends BaseEntity {

    /**
     * 主键
     */
    @NotNull(message = "主键不能为空", groups = { EditGroup.class })
    private Long id;

    /**
     * 代理商编号
     */
    private String no;

    /**
     * 代理商类型（1：企业，:2：个人）
     */
    @NotNull(message = "代理商类型不能为空", groups = { AddGroup.class, EditGroup.class })
    private Integer dwType;

    /**
     * 代理商名称
     */
    @NotBlank(message = "代理商名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String name;

    /**
     * 统一社会信用代码
     */
    @NotBlank(message = "统一社会信用代码不能为空", groups = { AddGroup.class, EditGroup.class })
    private String nsrSbh;

    /**
     * 法人姓名
     */
    @NotBlank(message = "法人姓名不能为空", groups = { AddGroup.class, EditGroup.class })
    private String fr;

    /**
     * 法人身份证
     */
    @NotBlank(message = "法人身份证不能为空", groups = { AddGroup.class, EditGroup.class })
    private String frSfz;

    /**
     * 法人手机号
     */
    @NotBlank(message = "法人手机号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String frSjh;

    /**
     * 经办人姓名
     */
    @NotBlank(message = "经办人姓名不能为空", groups = { AddGroup.class, EditGroup.class })
    private String wtr;

    /**
     * 经办人手机号
     */
    @NotBlank(message = "经办人手机号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String wtrSjh;

    /**
     * 经办人身份证
     */
//    @NotBlank(message = "经办人身份证不能为空", groups = { AddGroup.class, EditGroup.class })
    private String wtrSfz;

    /**
     * 经办人邮件
     */
    @NotBlank(message = "经办人邮件不能为空", groups = { AddGroup.class, EditGroup.class })
    private String wtrEmail;

    /**
     * 所属行政区编码
     */
    @NotBlank(message = "所属行政区编码不能为空", groups = { AddGroup.class, EditGroup.class })
    private String unitArea;

    /**
     * 行政区名称
     */
    @NotBlank(message = "行政区名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String unitAreaName;

    /**
     * 实际经营地址
     */
    @NotBlank(message = "实际经营地址不能为空", groups = { AddGroup.class, EditGroup.class })
    private String address;

    /**
     * 开户名
     */
    @NotBlank(message = "开户名不能为空", groups = { AddGroup.class, EditGroup.class })
    private String khm;

    /**
     * 开户账号
     */
    @NotBlank(message = "开户账号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String bankCard;

    /**
     * 开户支行
     */
    @NotBlank(message = "开户支行不能为空", groups = { AddGroup.class, EditGroup.class })
    private String khd;

    /**
     * 开户行
     */
    @NotBlank(message = "开户行不能为空", groups = { AddGroup.class, EditGroup.class })
    private String khh;

    /**
     * 开户行行号/银联号
     */
    @NotBlank(message = "开户行行号/银联号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String khhNo;

    /**
     * 支付宝登录号(支持邮箱和手机号格式)
     */
    private String alipayLogonId;

    /**
     * 法人身份证正面
     */
    @NotBlank(message = "法人身份证正面不能为空", groups = { AddGroup.class, EditGroup.class })
    private String frSfzzm;

    /**
     * 法人身份证反面
     */
    @NotBlank(message = "法人身份证反面不能为空", groups = { AddGroup.class, EditGroup.class })
    private String frSfzfm;

    /**
     * 银行卡正面
     */
//    @NotBlank(message = "银行卡正面不能为空", groups = { AddGroup.class, EditGroup.class })
    private String bankZm;

    /**
     * 状态（0:禁用 1:启用 ）
     */
    private Long status;

    /**
     * 父级代理商
     */
    private Long pId;

    /**
     * 代理上下级关系编码
     */
    private String levelCode;

    /**
     * 审核状态（0:待审核、1:驳回、2:审核通过）
     */
//    @NotNull(message = "审核状态（0:待审核、1:驳回、2:审核通过）不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long verifyStatus;

    /**
     * 审核时间
     */
    private Date verifyTime;

    /**
     * 审核人
     */
    private String verifyBy;

    /**
     * 驳回原因
     */
    private String verifyReason;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8",pattern="yyyy-MM-dd")
    private Date startTime;

    public Date getEndTime() {
        if(this.endTime != null){
            return DateUtils.addOneDay(this.endTime);
        }
        return endTime;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8",pattern="yyyy-MM-dd")
    private Date endTime;


    private String yyzz;

    private String khxkz ;

    private Integer dwLevel;

    private Long createUnitId;

    private String createUnitNo;

    private Integer isProduct;


}
