package com.bocloud.ims.entity.resource;

import com.alibaba.fastjson.JSONArray;
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;

/**
 * 负载均衡器成员池实体类
 * 
 * @author wangyu
 * @version 1.0
 * @since 2017年9月4日
 *
 */
@Table("lb_pool")
public class LbPool extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id;
	@Column("pool_uuid")
	private String poolUuid;// 池UUID
	@Column("tenant_uuid")
	private String tenantUuid;// 租户UUID
	@Column("protocol")
	private String protocol;// 协议(HTTP/HTTPS/TCP)
	@Column("lb_method")
	private String lbMethod;// 负载均衡方法(ROUND_ROBIN/LEAST_CONNECTIONS/SOURCE_IP)
	@Column("cookie_name")
	private String cookieName;// cookie名称
	@Column("type")
	private String type;// 会话持久类型(APP_COOKIE/HTTP_COOKIE/SOURCE_IP)
	@Column("admin_stateup")
	private Boolean adminStateUp;// 管理状态
	@Column("listener_id")
	private Long listenerId;// 监听器ID
	@Column("listener_uuid")
	private String listenerUuid;// 监听器UUID
	@Column("hm_uuid")
	private String hmUuid;// 健康检查UUID
	@Column("vendor_id")
	private Long vendorId;// 云平台ID
	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("project_id")
	private Long projectId;// 项目ID
	@Column("region_id")
	private String regionId;
	@Column("lb_id")
	private Long lbId;// 负载均衡ID
	@Column("lb_uuid")
	private String lbUuid;// 负载均衡UUID
	@Column("persistence_timeout")
	private Integer persistenceTimeout;// 会话保持的超时时间
	@IgnoreAll
	private String tenantName;// 所属租户
	@IgnoreAll
	private JSONArray members;
	@IgnoreAll
	private HealthMonitor monitor;// 健康检查
	@IgnoreAll
	private String listeners;

	/**
	 * 
	 */
	public LbPool() {
		super();
	}

	public void preSave(Long creatorId, Long menderId, Long vendorId, Long listenerId, Long tenantId, Long projectId) {
		this.setCreatorId(creatorId);
		this.setMenderId(menderId);
		this.setVendorId(vendorId);
		this.setListenerId(listenerId);
		this.setTenantId(tenantId);
		this.setProjectId(projectId);
	}

	/**
	 * @param poolUuid
	 * @param tenantUuid
	 * @param protocol
	 * @param lbMethod
	 * @param cookieName
	 * @param type
	 * @param adminStateUp
	 * @param listenerId
	 * @param listenerUuid
	 * @param hmUuid
	 * @param vendorId
	 */
	public LbPool(String poolUuid, String tenantUuid, String protocol, String lbMethod, String cookieName, String type,
			Boolean adminStateUp, Long listenerId, String listenerUuid, String hmUuid, Long vendorId) {
		super();
		this.poolUuid = poolUuid;
		this.tenantUuid = tenantUuid;
		this.protocol = protocol;
		this.lbMethod = lbMethod;
		this.cookieName = cookieName;
		this.type = type;
		this.adminStateUp = adminStateUp;
		this.listenerId = listenerId;
		this.listenerUuid = listenerUuid;
		this.hmUuid = hmUuid;
		this.vendorId = vendorId;
	}

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

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

	/**
	 * @return the poolUuid
	 */
	public String getPoolUuid() {
		return poolUuid;
	}

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

	/**
	 * @return the tenantUuid
	 */
	public String getTenantUuid() {
		return tenantUuid;
	}

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

	/**
	 * @return the protocol
	 */
	public String getProtocol() {
		return protocol;
	}

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

	/**
	 * @return the lbMethod
	 */
	public String getLbMethod() {
		return lbMethod;
	}

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

	/**
	 * @return the cookieName
	 */
	public String getCookieName() {
		return cookieName;
	}

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

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

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

	/**
	 * @return the adminStateUp
	 */
	public Boolean getAdminStateUp() {
		return adminStateUp;
	}

	/**
	 * @param adminStateUp the adminStateUp to set
	 */
	public void setAdminStateUp(Boolean adminStateUp) {
		this.adminStateUp = adminStateUp;
	}

	/**
	 * @return the listenerId
	 */
	public Long getListenerId() {
		return listenerId;
	}

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

	/**
	 * @return the listenerUuid
	 */
	public String getListenerUuid() {
		return listenerUuid;
	}

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

	/**
	 * @return the hmUuid
	 */
	public String getHmUuid() {
		return hmUuid;
	}

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

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

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

	/**
	 * @return the tenantId
	 */
	public Long getTenantId() {
		return tenantId;
	}

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

	/**
	 * @return the tenantName
	 */
	public String getTenantName() {
		return tenantName;
	}

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

	/**
	 * @return the projectId
	 */
	public Long getProjectId() {
		return projectId;
	}

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

	public String getRegionId() {
		return regionId;
	}

	public void setRegionId(String regionId) {
		this.regionId = regionId;
	}

	public Long getLbId() {
		return lbId;
	}

	public void setLbId(Long lbId) {
		this.lbId = lbId;
	}

	public String getLbUuid() {
		return lbUuid;
	}

	public void setLbUuid(String lbUuid) {
		this.lbUuid = lbUuid;
	}

	public Integer getPersistenceTimeout() {
		return persistenceTimeout;
	}

	public void setPersistenceTimeout(Integer persistenceTimeout) {
		this.persistenceTimeout = persistenceTimeout;
	}

	public JSONArray getMembers() {
		return members;
	}

	public void setMembers(JSONArray members) {
		this.members = members;
	}

	public HealthMonitor getMonitor() {
		return monitor;
	}

	public void setMonitor(HealthMonitor monitor) {
		this.monitor = monitor;
	}

	public String getListeners() {
		return listeners;
	}

	public void setListeners(String listeners) {
		this.listeners = listeners;
	}

}
