package com.microservices.mon.k8s.domain;

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

import java.util.Date;


@Data
@ApiModel("K8S容器")
public class K8sApplicationPod {

    @ApiModelProperty(value = "容器Id")
    private String id;

    @ApiModelProperty(value = "容器名称")
    private String name;

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

    @ApiModelProperty(value = "容器Ip")
    private String ip;

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

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

    @ApiModelProperty(value = "是否正常运行")
    private Boolean isRunning;

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

    @ApiModelProperty(value = "所有权")
    private String serviceAccountName;

    @ApiModelProperty(value = "容器端口")
    private String ports;

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

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

    @ApiModelProperty(value = "有效副本数量")
    private Integer readyReplicas;

    @ApiModelProperty(value = "所属堆栈")
    private String stack;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;
    
//    public void setDockerImage(String dockerImage) {
//        this.dockerImage = MonUtils.getDockerImage(dockerImage);
//    }
}
