package com.bocloud.ims.entity.resource.kubernetes;

import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * k8s服务
 * 
 * @author weiwei
 *
 */
@Table("kube_service")
public class KubeService extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("instance_id")
	private String instanceId;// 实例ID
	@Column("ns_id")
	private Long nsId; // 命名空间ID
	@Column("vendor_id")
	private Long vendorId; // 云供应商Id
	@Column("labels")
	private String labels;
	@Column("selector")
	private String selector;//
	@Column("ns_name")
	private String namespace;
	@Column("cluster_ip")
	private String clusterIp;
	@Column("yaml_text")
	private String yamlText;
	@Column("internal_endpoint")
	private String internalEndpoint; // 内部端点
	@Column("type")
	private String type;
	@Column("tenant_id")
	private Long tenantId;
	@Column("project_id")
	private Long projectId;// 项目ID
	@IgnoreAll
	private String projectVisibility;
	@Column("uid")
	private String uid;// uuid
	@Column("app_id")
	private Long appId;
	@Column("app_name")
	private String appName;
	@Column("kind")
	private String kind;
	@Column("api_version")
	private String apiVersion;
	@Column("ports")
	private String ports;
	
	@Column("creation_time")
	@JsonSerialize(using = com.bocloud.common.utils.DateSerializer.class)
	@JsonDeserialize(using = com.bocloud.common.utils.DateDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date creationTime;

	@Column("vdc_id")
	private Long vdcId;
	@Column("poolgroup_id")
	private Long poolGroupId;

	@IgnoreAll
	private String vendorName; // 云供应商名称
	@IgnoreAll
	private String vendorType; // 云供应商名称
	@IgnoreAll
	private String tenantName;// 所属租户
	@IgnoreAll
	private Long serviceId;
	@IgnoreAll
	private String serviceKind;

	@IgnoreAll
	private String vdcName;
	@IgnoreAll
	private String poolGroupName;

	@IgnoreAll
	private String serviceConfig;// 所属租户

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the instanceId
	 */
	public String getInstanceId() {
		return instanceId;
	}

	/**
	 * @param instanceId
	 *            the instanceId to set
	 */
	public void setInstanceId(String instanceId) {
		this.instanceId = instanceId;
	}

	/**
	 * @return the nsId
	 */
	public Long getNsId() {
		return nsId;
	}

	/**
	 * @param nsId
	 *            the nsId to set
	 */
	public void setNsId(Long nsId) {
		this.nsId = nsId;
	}

	/**
	 * @return the vendorId
	 */
	public Long getVendorId() {
		return vendorId;
	}

	/**
	 * @param vendorId
	 *            the vendorId to set
	 */
	public void setVendorId(Long vendorId) {
		this.vendorId = vendorId;
	}

	public KubeService() {
		super();
	}

	public void preSave(Long creatorId, Long menderId, Long vendorId, Long nsId) {
		this.setCreatorId(creatorId);
		this.setMenderId(menderId);
		this.setVendorId(vendorId);
		this.setNsId(nsId);
	}

	public String getLabels() {
		return labels;
	}

	public void setLabels(String labels) {
		this.labels = labels;
	}

	public String getSelector() {
		return selector;
	}

	public void setSelector(String selector) {
		this.selector = selector;
	}

	public String getNamespace() {
		return namespace;
	}

	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}

	public String getClusterIp() {
		return clusterIp;
	}

	public void setClusterIp(String clusterIp) {
		this.clusterIp = clusterIp;
	}

	public String getYamlText() {
		return yamlText;
	}

	public void setYamlText(String yamlText) {
		this.yamlText = yamlText;
	}

	public String getInternalEndpoint() {
		return internalEndpoint;
	}

	public void setInternalEndpoint(String internalEndpoint) {
		this.internalEndpoint = internalEndpoint;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	public Long getTenantId() {
		return tenantId;
	}

	public void setTenantId(Long tenantId) {
		this.tenantId = tenantId;
	}

	public Long getProjectId() {
		return projectId;
	}

	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

	public String getVendorName() {
		return vendorName;
	}

	public void setVendorName(String vendorName) {
		this.vendorName = vendorName;
	}

	public String getVendorType() {
		return vendorType;
	}

	public void setVendorType(String vendorType) {
		this.vendorType = vendorType;
	}

	public String getTenantName() {
		return tenantName;
	}

	public void setTenantName(String tenantName) {
		this.tenantName = tenantName;
	}

	public String getProjectVisibility() {
		return projectVisibility;
	}

	public void setProjectVisibility(String projectVisibility) {
		this.projectVisibility = projectVisibility;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public Long getAppId() {
		return appId;
	}

	public void setAppId(Long appId) {
		this.appId = appId;
	}

	public String getAppName() {
		return appName;
	}

	public void setAppName(String appName) {
		this.appName = appName;
	}

	public String getKind() {
		return kind;
	}

	public void setKind(String kind) {
		this.kind = kind;
	}

	public String getApiVersion() {
		return apiVersion;
	}

	public void setApiVersion(String apiVersion) {
		this.apiVersion = apiVersion;
	}

	public Long getVdcId() {
		return vdcId;
	}

	public void setVdcId(Long vdcId) {
		this.vdcId = vdcId;
	}

	public Long getPoolGroupId() {
		return poolGroupId;
	}

	public void setPoolGroupId(Long poolGroupId) {
		this.poolGroupId = poolGroupId;
	}

	public Long getServiceId() {
		return serviceId;
	}

	public void setServiceId(Long serviceId) {
		this.serviceId = serviceId;
	}

	public String getPorts() {
		return ports;
	}

	public void setPorts(String ports) {
		this.ports = ports;
	}

	public String getServiceConfig() {
		return serviceConfig;
	}

	public void setServiceConfig(String serviceConfig) {
		this.serviceConfig = serviceConfig;
	}

	public String getServiceKind() {
		return serviceKind;
	}

	public void setServiceKind(String serviceKind) {
		this.serviceKind = serviceKind;
	}

	public String getVdcName() {
		return vdcName;
	}

	public void setVdcName(String vdcName) {
		this.vdcName = vdcName;
	}

	public String getPoolGroupName() {
		return poolGroupName;
	}

	public void setPoolGroupName(String poolGroupName) {
		this.poolGroupName = poolGroupName;
	}

	public Date getCreationTime() {
		return creationTime;
	}

	public void setCreationTime(Date creationTime) {
		this.creationTime = creationTime;
	}

}
