package com.jpsoft.shinestar.modules.business.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jpsoft.shinestar.modules.base.dto.ApprovalDTO;
import com.jpsoft.shinestar.modules.common.utils.TypeNameUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

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

@Data
public class RequestForLeaveDetailDto {

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "个人照片")
    private String picUrl;

    @ApiModelProperty(value = "请假类型")
    private String leaveTypeN;

    @ApiModelProperty(value = "状态 0-未处理，1-已批准，2-已拒绝")
    private Integer status;

    @ApiModelProperty(value = "状态 0-未处理，1-已批准，2-已拒绝")
    private String statusN;

    @ApiModelProperty(value = "身份证号")
    private String idCard;

    @ApiModelProperty(value = "工号")
    private String jobNumber;

    @ApiModelProperty(value = "部门")
    private String department;

    @ApiModelProperty(value = "开始时间")
    private String startTime;

    @ApiModelProperty(value = "结束时间")
    private String endTime;

    @ApiModelProperty(value = "开始时间段（0：上午，1：下午）")
    private String startTimeQuantum;

    @ApiModelProperty(value = "结束时间段（0：上午，1：下午）")
    private String endTimeQuantum;

    @ApiModelProperty(value = "请假理由")
    private String reason;

    @ApiModelProperty(value = "上传照片")
    private String imageUrl;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "审批人")
    private String approvedName;

    @ApiModelProperty(value = "审批意见")
    private String approvalOpinions;

    @ApiModelProperty(value = "意见说明")
    private String approvalExplain;

    @ApiModelProperty(value = "审核时间")
    private String approvedTime;

    private List<ApprovalDTO> list;

    private Boolean approvalEnable;

    public String getStatusN(){
        String text = TypeNameUtil.getExamineTypeName(String.valueOf(status));
        return text;
        /*if (Integer.valueOf(0).equals(status)){
            return "未处理";
        }
        else if (Integer.valueOf(1).equals(status)){
            return "已批准";
        }
        else if (Integer.valueOf(2).equals(status)){
            return "已拒绝";
        }
        else{
            return "";
        }*/
    }
}
