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

import org.dromara.common.core.utils.DateUtils;
import org.dromara.payment.channel.domain.BusChannelSalesman;
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_salesman
 *
 * @author LionLi
 * @date 2024-04-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = BusChannelSalesman.class, reverseConvertGenerate = false)
public class BusChannelSalesmanBo extends BaseEntity {

    /**
     * 主键
     */
    private Long id;

    /**
     * 代理商id
     */
    private Long channelId;

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

    //代理商名称
    private String channelName;

    /**
     * 业务员名称
     */
    @NotNull(message = "业务员名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String name;


    private Date createTime;



    /**
     * 业务员编号
     */
    private String no;

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

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

    private String remarker;


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