package com.bocloud.ims.entity.resource;

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月3日
 *
 */
@Table("health_monitor")
public class HealthMonitor extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id;// ID
	@Column("health_uuid")
	private String healthUuid;// uuid
	@Column("tenant_uuid")
	private String tenantUuid;// 租户ID
	@Column("type")
	private String type;// 健康检查类型
	@Column("delay")
	private Integer delay;// 延期时间
	@Column("timeout")
	private Integer timeout;// 超时时间
	@Column("max_retries")
	private Integer maxRetries;// 最大重试次数
	@Column("http_method")
	private String httpMethod;// http方法
	@Column("url_path")
	private String urlPath;// URL路径
	@Column("expected_codes")
	private String expectedCodes;// 期望码
	@Column("admin_stateup")
	private Boolean adminStateUp;// 网络管理状态
	@Column("vendor_id")
	private Long vendorId;// 云平台ID
	@Column("pool_uuid")
	private String poolUuid;
	@Column("pool_id")
	private Long poolId;
	@Column("listener_id")
	private Long listenerId;
	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("project_id")
	private Long projectId;// 项目ID
	@IgnoreAll
	private String tenantName;// 所属租户

	@Column("region_id")
	private String regionId;
	@Column("monitor_port")
	private Integer monitorPort;// 健康检查端口号
	@Column("domain_name")
	private String domainName;// 健康检查测试member健康状态时,发送的http请求的域名。仅当type为HTTP时生效

	public HealthMonitor() {
		super();
	}

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

	/**
	 * @param healthUuid
	 * @param tenantUuid
	 * @param type
	 * @param delay
	 * @param timeout
	 * @param maxRetries
	 * @param httpMethod
	 * @param urlPath
	 * @param expectedCodes
	 * @param adminStateUp
	 * @param poolId
	 * @param poolUuid
	 * @param vendorId
	 */
	public HealthMonitor(String healthUuid, String tenantUuid, String type, Integer delay, Integer timeout,
			Integer maxRetries, String httpMethod, String urlPath, String expectedCodes, Boolean adminStateUp,
			Long vendorId) {
		super();
		this.healthUuid = healthUuid;
		this.tenantUuid = tenantUuid;
		this.type = type;
		this.delay = delay;
		this.timeout = timeout;
		this.maxRetries = maxRetries;
		this.httpMethod = httpMethod;
		this.urlPath = urlPath;
		this.expectedCodes = expectedCodes;
		this.adminStateUp = adminStateUp;
		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 healthUuid
	 */
	public String getHealthUuid() {
		return healthUuid;
	}

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

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

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

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

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

	/**
	 * @return the delay
	 */
	public Integer getDelay() {
		return delay;
	}

	/**
	 * @param delay the delay to set
	 */
	public void setDelay(Integer delay) {
		this.delay = delay;
	}

	/**
	 * @return the timeout
	 */
	public Integer getTimeout() {
		return timeout;
	}

	/**
	 * @param timeout the timeout to set
	 */
	public void setTimeout(Integer timeout) {
		this.timeout = timeout;
	}

	/**
	 * @return the maxRetries
	 */
	public Integer getMaxRetries() {
		return maxRetries;
	}

	/**
	 * @param maxRetries the maxRetries to set
	 */
	public void setMaxRetries(Integer maxRetries) {
		this.maxRetries = maxRetries;
	}

	/**
	 * @return the httpMethod
	 */
	public String getHttpMethod() {
		return httpMethod;
	}

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

	/**
	 * @return the urlPath
	 */
	public String getUrlPath() {
		return urlPath;
	}

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

	/**
	 * @return the expectedCodes
	 */
	public String getExpectedCodes() {
		return expectedCodes;
	}

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

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

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

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

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

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

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

	/**
	 * @return the poolId
	 */
	public Long getPoolId() {
		return poolId;
	}

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

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

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

	/**
	 * @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 Integer getMonitorPort() {
		return monitorPort;
	}

	public void setMonitorPort(Integer monitorPort) {
		this.monitorPort = monitorPort;
	}

	public String getDomainName() {
		return domainName;
	}

	public void setDomainName(String domainName) {
		this.domainName = domainName;
	}

}
