package com.ningdatech.pmapi.safety.model.vo;

import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;
import java.util.Optional;

/**
 * @Classname ProjectMonitorVO
 * @Description
 * @Date 2023/8/2 9:19
 * @Author PoffyZhang
 */
@Data
@ApiModel(value = "ProjectMonitorVO", description = "项目监控VO")
public class ProjectMonitorVO {

    @ApiModelProperty("项目ID")
    private Long id;

    @ApiModelProperty("项目名称")
    private String projectName;

    @ApiModelProperty("项目编号")
    private String projectCode;

    @ApiModelProperty("申报单位code")
    private String buildOrgCode;

    @ApiModelProperty("申报单位名")
    private String buildOrgName;

    @ApiModelProperty("项目年度")
    private Integer projectYear;

    @ApiModelProperty("项目类型")
    private Integer projectType;

    @ApiModelProperty("项目类型名")
    private String projectTypeName;

    public String getProjectTypeName() {
        if (Objects.nonNull(this.projectType)) {
            Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType))
                    .ifPresent(desc -> this.projectTypeName = desc);
        }
        return this.projectTypeName;
    }

    @ApiModelProperty("项目阶段")
    private Integer stage;

    @ApiModelProperty("项目状态")
    private Integer status;

    @ApiModelProperty("项目阶段中文")
    private String stageName;
    public String getStageName(){
        if(Objects.nonNull(this.stage)){
            return ProjectStatusEnum.getDesc(this.stage);
        }
        return StringUtils.EMPTY;
    }

    @ApiModelProperty("项目状态中文")
    private String statusName;
    public String getStatusName(){
        if(Objects.nonNull(this.status)){
            return ProjectStatusEnum.getDesc(this.status);
        }
        return StringUtils.EMPTY;
    }
}
