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

import org.dromara.common.core.utils.DateUtils;
import org.dromara.payment.worker.domain.UserWorkerAuthorized;
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;

/**
 * 授权协议业务对象 user_worker_authorized
 *
 * @author LionLi
 * @date 2024-04-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = UserWorkerAuthorized.class, reverseConvertGenerate = false)
public class UserWorkerAuthorizedBo extends BaseEntity {

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

    /**
     * 自雇者id
     */
    @NotNull(message = "自雇者id不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long workId;

    /**
     * 运营商id
     */
    @NotNull(message = "运营商id不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long opId;

    /**
     * 运营商编号
     */
    @NotBlank(message = "运营商编号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String opNo;

    /**
     * 签约状态（0:待签约 1:签约中 2:已签约 3:归档失败）
     */
    @NotNull(message = "签约状态（0:待签约 1:签约中 2:已签约 3:归档失败）不能为空", groups = { AddGroup.class, EditGroup.class })
    private Integer signStatus;

    /**
     * 合同编号
     */
    @NotBlank(message = "合同编号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String no;

    /**
     * 签约时间
     */
    @NotNull(message = "签约时间不能为空", groups = { AddGroup.class, EditGroup.class })
    private Date signTime;

    /**
     * 签约文件地址
     */
    @NotBlank(message = "签约文件地址不能为空", groups = { AddGroup.class, EditGroup.class })
    private String signFileUrl;

    /**
     * 协议签字图片
     */
    @NotBlank(message = "协议签字图片不能为空", groups = { AddGroup.class, EditGroup.class })
    private String signPic;



    @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 scaleName;


    private String opName;

    private String workName;

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



}
