package com.hz.pm.api.projectdeclared.model.vo;

import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Optional;

/**
 * <p>
 * ProjectLibListItemVO
 * </p>
 *
 * @author WendyYang
 * @since 15:13 2023/2/1
 */
@Data
@ApiModel("申报项目列表视图")
public class ProjectDeclaredListItemVO {

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

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

    @ApiModelProperty("申报金额")
    private BigDecimal declaredAmount;

    @ApiModelProperty("批复金额")
    private BigDecimal approvedAmount;

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

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

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

    @ApiModelProperty("申报年度")
    private Integer projectYear;

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

    @ApiModelProperty("业务领域")
    private String bizDomain;

    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 LocalDateTime createOn;

    @ApiModelProperty("修改时间")
    private LocalDateTime updateOn;

}
