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

import com.bocloud.cmp.model.kubernetes.DeploymentModel;
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;
import java.util.List;

/**
 * k8s命名空间
 * 
 * @author weiwei
 *
 */
@Table("kube_namespace")
public class KubeNamespace extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("instance_id")
	private String instanceId;// 实例ID
	@Column("vendor_id")
	private Long vendorId; // 云供应商Id
	@Column("uid")
	private String uid;// uuid

	@Column("kind")
	private String kind;
	@Column("api_version")
	private String apiVersion;

	@Column("tenant_id")
	private Long tenantId;
	@Column("default_cpu")
	private String defaultCpu;
	@Column("default_memory")
	private String defaultMemory;
	@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;

	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String tenantName;
	@IgnoreAll
	private String vdcName;
	@IgnoreAll
	private List<DeploymentModel> childs;

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

	public String getUid() {
		return uid;
	}

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

	/**
	 * @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 vendorId
	 */
	public Long getVendorId() {
		return vendorId;
	}

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

	public KubeNamespace() {
		super();
	}

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

	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 getTenantId() {
		return tenantId;
	}

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

	public String getDefaultCpu() {
		return defaultCpu;
	}

	public void setDefaultCpu(String defaultCpu) {
		this.defaultCpu = defaultCpu;
	}

	public String getDefaultMemory() {
		return defaultMemory;
	}

	public void setDefaultMemory(String defaultMemory) {
		this.defaultMemory = defaultMemory;
	}

	public String getVendorName() {
		return vendorName;
	}

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

	public Date getCreationTime() {
		return creationTime;
	}

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

	public List<DeploymentModel> getChilds() {
		return childs;
	}

	public void setChilds(List<DeploymentModel> childs) {
		this.childs = childs;
	}

	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 String getVdcName() {
		return vdcName;
	}

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

	public String getTenantName() {
		return tenantName;
	}

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

}
