package cn.estsh.i3plus.pojo.ics.bean;

import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @Description : 应用信息
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2020-04-09 17:55
 * @Modify:
 **/
@Data
@ApiModel("应用信息")
public class IcsApplication implements Serializable {

    private static final long serialVersionUID = -1923997516217683087L;
    @ApiModelProperty("应用名称")
    private String appName;

    @ApiModelProperty("实例数量")
    private Integer totalInstanceNum;

    @ApiModelProperty("在线实例数量")
    private Integer upInstanceNum;

    public int getUpInstanceNumVal() {
        return upInstanceNum == null ? 0 : upInstanceNum.intValue();
    }


    public void addUpInstanceNum() {
        if (upInstanceNum == null) {
            upInstanceNum = 0;
        }
        upInstanceNum++;
    }

    @ApiModelProperty("下线实例数量")
    private Integer downInstanceNum;

    public int getDownInstanceNumVal() {
        return downInstanceNum == null ? 0 : downInstanceNum.intValue();
    }

    public void addDownInstanceNum() {
        if (downInstanceNum == null) {
            downInstanceNum = 0;
        }
        downInstanceNum++;
    }

    @ApiModelProperty("应用状态")
    private Integer appStatus;

    public String getAppStatusTxt(){
        return appStatus == null ?"无": CommonEnumUtil.CLOUD_APP_STATUS.valueOfDescription(appStatus);
    }

    @ApiModelProperty("状态时间戳")
    private Long statusTimeStamp;

    @ApiModelProperty("状态时间")
    private String statusTimeStampStr;

    @ApiModelProperty("实例集合")
    private List<IcsInstance> icsInstanceList;

}
