package com.microservices.mon.k8s.domain;

import com.microservices.mon.k8s.utils.MonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;


@Data
@ApiModel("K8S应用")
public class K8sApplication {

    @ApiModelProperty(value = "应用Id")
    private String id;

    @ApiModelProperty(value = "应用名称")
    private String name;

    @ApiModelProperty(value = "应用别名")
    private String alias;

    @ApiModelProperty(value = "应用类型")
    private String kind;

    @ApiModelProperty(value = "所属命名空间")
    private String namespace;

    @ApiModelProperty(value = "副本数量")
    private Integer replicas;

    @ApiModelProperty(value = "有效副本数量(当有效副本数为0时代表应用失败呈现红色；当有效副本数大于0但小于副本数时代表应用部分失败呈现橙色；当有效副本数等于副本数代表应用正常呈现蓝色)")
    private Integer readyReplicas;

    @ApiModelProperty(value = "容器选择器")
    private String podSelector;

    @ApiModelProperty(value = "Docker镜像")
    private String dockerImage;

    @ApiModelProperty(value = "重启次数")
    private Integer restartCount;

    @ApiModelProperty(value = "存活时间")
    private String survivalTime;

    @ApiModelProperty(value = "运行状态")
    private K8sApplicationAndPodState state;

    @ApiModelProperty(value = "暂停编排")
    private Boolean paused;

    private List<K8sApplicationPod> podList;

//    public void setDockerImage(String dockerImage) {
//        this.dockerImage = MonUtils.getDockerImage(dockerImage);
//    }
}
