package jnpf.model.workflow.dto;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.List;

/**
 * describe
 *
 * @author HuangLinPan
 * @date 2023/12/13
 */
@Getter
@Setter
@ToString(callSuper = true)
public class SelfApproveDto  extends AttendanceBaseForOa{

    private String taskId;

    /**
     * 借调考勤组
     */
    private String groupId;

    /**
     * 被借调考勤组id
     */
    private String selfGroupId;

    /**
     * 借调考勤组名称
     */
    private String groupName;

    /**
     * 被借调考勤组名称
     */
    private String selfGroupName;

    /**
     * 借调开始时间
     */
    private Date startTime;

    /**
     * 借调结束时间
     */
    private Date endTime;

    public Date getStartTime() {
        if (time != null && time.length > 1) {
            return new Date(Long.parseLong(time[0]));
        }
        return startTime;
    }

    public Date getEndTime() {
        if (time != null && time.length > 1) {
            return new Date(Long.parseLong(time[1]));
        }
        return endTime;
    }

    /**
     * 申请传入时间
     */
    private String[] time;

    /**
     * 流程任务主键
     */
    private String flowtaskid;

    /**
     * 流程id
     */
    private String flowid;

    /**
     * 唯一id
     */
    private String uniqueid;

    /**
     * 租户ID
     */
    private String tenantId;


    /**
     * 照片 暂弃
     */
    private String picture;

    /**
     * 照片
     */
    private String fileJson;

    /** 流程标题 */
    private String flowTitle;

    /** 申请人员 */
    private String applyUser;

    /** 申请日期 */
    private Date applyDate;

    /**
     * 是否审核通过 0.待审核  1.通过 2.未通过
     */
    private Integer status = 0;

    /** 被借调用户ids 暂弃 */
    private List<UserSelfDto> userSelfDtos;

    /** 被借调用户ids */
    private List<String> userIds;


    /** 提交/保存 0-1 */
    private String submitStatus;

    /**
     * 理由原因
     */
    private String reason;

    /**
     * 离岗时间
     */
    private String[] departureTime;

//    public Date getDepartureTimeTime() {
//        if (null != departureTime && departureTime.length > 1) {
//            return new Date(Long.valueOf(departureTime[0]));
//        }
//        return leaveTime;
//    }
//
//    public Date getBackTime() {
//        if (null != departureTime && departureTime.length > 1) {
//            return new Date(Long.valueOf(departureTime[1]));
//        }
//        return returnTime;
//    }

    /**
     * 回岗时间
     */
    private Date backTime;

    /**
     * 离岗时间
     */
    private Date leaveTime;

    /**
     * 回岗时间
     */
    private Date returnTime;


    public Date getLeaveTime() {
        if (null != departureTime && departureTime.length > 1) {
            return new Date(Long.valueOf(departureTime[0]));
        }
        return leaveTime;
    }

    public Date getReturnTime() {
        if (null != departureTime && departureTime.length > 1) {
            return new Date(Long.valueOf(departureTime[1]));
        }
        return returnTime;
    }
}
