package com.bocloud.ims.entity.resource;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.bocloud.common.model.RequestContext.Catalog;
import com.bocloud.common.utils.DaySerializer;
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.JsonSerialize;

/**
 * 负载均衡器实体类
 *
 * @author wangyu
 * @version 1.0
 * @since 2017年8月29日
 */
@Table("load_balancer")
public class LoadBalancer extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id;// ID
	@Column("lb_uuid")
	private String lbUuid;// 负载均衡器ID
	@Column("fee_type")
	private Integer feeType;// 资费类别
	@Column("subnet_id")
	private Long subnetId;// 子网ID
	@Column("subnet_uuid")
	private String subnetUuid;// 子网UUID
	@Column("tenant_uuid")
	private String tenantUuid;// 租户
	@Column("vip_address")
	private String vipAddress;// vip地址
	@Column("vip_port_uuid")
	private String vipPortUuid;// vip端口ID
	@Column("admin_stateup")
	private Boolean adminStateUp;// 管理状态
	@Column("provisioning_status")
	private String provisioningStatus;// 准备状态
	@Column("operating_status")
	private String operatingStatus;// 操作状态
	@Column("provider")
	private String provider;// 供应者
	@Column("vendor_id")
	private Long vendorId;// 云平台ID
	@Column("port_id")
	private Long portId;// 端口ID
	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("project_id")
	private Long projectId;// 项目ID
	@Column("vpc_id")
	private Long vpcId;
	@Column("vpc_uuid")
	private String vpcUuid;
	@Column("region")
	private String region;
	@Column("scheme")
	private String scheme;
	@Column("ip_address_type")
	private String ipAddressType;
	@Column("load_balancer_type")
	private String loadBalancerType;
	@Column("availability_zones")
	private Object availabilityZones;
	@Column("security_groups")
	private Object securityGroups;
	@Column("labels")
	private String labels;
	@Column("business_id")
	private Long businessId;
	@IgnoreAll
	private int listenerNum;// 监听器总数
	@IgnoreAll
	private String floatingIpAddress;// 浮动IP
	@IgnoreAll
	private Long fipId;
	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String tenantName;
	@IgnoreAll
	private String osTenantName;
	@IgnoreAll
	private String regionName;
	@IgnoreAll
    private String userName;// 用户名称
    @IgnoreAll
    private String businessName;// 业务
    @IgnoreAll
    private String creatorName;// 创建者名称
    @IgnoreAll
    private String ownerName;// 所属人名称
    @IgnoreAll
    private String menderName;// 维护人名称
    @IgnoreAll
	private String projectName;// 所属项目

	@Column("expired_time")
	@JsonSerialize(using = DaySerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date expiredTime;// 过期时间
	@Column("uuid")
	private String uuid;// uuid，对应子订单号
	@Column("catalog")
	private Catalog catalog;// 账号类别
	
	@Column("spec")
	private String spec;
	@Column("resource_group_id")
	private Long resourceGroupId;
	@Column("resource_group_uuid")
	private String resourceGroupUuid;// 资源组id
	@Column("network_type")
	private String networkType;
	@Column("delete_protection")
	private String deleteProtection;
	@Column("internet_charge_type")
	private String internetChargeType; // 公网计费方式
	@Column("broadband_value")
	private Long broadbandValue;// 公网宽带值
	@Column("modification_protection")
	private String modificationProtection;
	@Column("modification_protection_reason")
	private String modificationProtectionReason;// 配置修改保护描述
	@IgnoreAll
	private String resourceGroupName;

	@IgnoreAll
	private String vipSubnetUuid;// vipV4子网ID

	@IgnoreAll
	private String action;

	public LoadBalancer() {
		super();
	}

	public void preSave(Long creatorId, Long menderId, Long vendorId, Long subnetId, Long portId, Long tenantId,
			Long projectId) {
		this.setCreatorId(creatorId);
		this.setMenderId(menderId);
		this.setVendorId(vendorId);
		this.setSubnetId(subnetId);
		this.setPortId(portId);
		this.setTenantId(tenantId);
		this.setProjectId(projectId);
	}

	/**
	 * @param lbUuid
	 * @param feeType
	 * @param subnetUuid
	 * @param tenantUuid
	 * @param vipAddress
	 * @param vipPortUuid
	 * @param adminStateUp
	 * @param provisioningStatus
	 * @param operatingStatus
	 * @param provider
	 */
	public LoadBalancer(String lbUuid, Integer feeType, String subnetUuid, String tenantUuid, String vipAddress,
			String vipPortUuid, Boolean adminStateUp, String provisioningStatus, String operatingStatus,
			String provider) {
		super();
		this.lbUuid = lbUuid;
		this.feeType = feeType;
		this.subnetUuid = subnetUuid;
		this.tenantUuid = tenantUuid;
		this.vipAddress = vipAddress;
		this.vipPortUuid = vipPortUuid;
		this.adminStateUp = adminStateUp;
		this.provisioningStatus = provisioningStatus;
		this.operatingStatus = operatingStatus;
		this.provider = provider;
	}

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

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

	/**
	 * @return the lbUuid
	 */
	public String getLbUuid() {
		return lbUuid;
	}

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

	/**
	 * @return the feeType
	 */
	public Integer getFeeType() {
		return feeType;
	}

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

	/**
	 * @return the subnetUuid
	 */
	public String getSubnetUuid() {
		return subnetUuid;
	}

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

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

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

	/**
	 * @return the vipAddress
	 */
	public String getVipAddress() {
		return vipAddress;
	}

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

	/**
	 * @return the vipPortUuid
	 */
	public String getVipPortUuid() {
		return vipPortUuid;
	}

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

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

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

	/**
	 * @return the provisioningStatus
	 */
	public String getProvisioningStatus() {
		return provisioningStatus;
	}

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

	/**
	 * @return the operatingStatus
	 */
	public String getOperatingStatus() {
		return operatingStatus;
	}

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

	/**
	 * @return the provider
	 */
	public String getProvider() {
		return provider;
	}

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

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

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

	/**
	 * @return the subnetId
	 */
	public Long getSubnetId() {
		return subnetId;
	}

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

	/**
	 * @return the listenerNum
	 */
	public int getListenerNum() {
		return listenerNum;
	}

	/**
	 * @param listenerNum the listenerNum to set
	 */
	public void setListenerNum(int listenerNum) {
		this.listenerNum = listenerNum;
	}

	/**
	 * @return the portId
	 */
	public Long getPortId() {
		return portId;
	}

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

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

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

	/**
	 * @return the floatingIpAddress
	 */
	public String getFloatingIpAddress() {
		return floatingIpAddress;
	}

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

	/**
	 * @return the fipId
	 */
	public Long getFipId() {
		return fipId;
	}

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

	/**
	 * @return the vendorName
	 */
	public String getVendorName() {
		return vendorName;
	}

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

	/**
	 * @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 Long getVpcId() {
		return vpcId;
	}

	public void setVpcId(Long vpcId) {
		this.vpcId = vpcId;
	}

	public String getVpcUuid() {
		return vpcUuid;
	}

	public void setVpcUuid(String vpcUuid) {
		this.vpcUuid = vpcUuid;
	}

	public String getRegion() {
		return region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	public String getOsTenantName() {
		return osTenantName;
	}

	public void setOsTenantName(String osTenantName) {
		this.osTenantName = osTenantName;
	}

	public String getScheme() {
		return scheme;
	}

	public void setScheme(String scheme) {
		this.scheme = scheme;
	}

	public String getIpAddressType() {
		return ipAddressType;
	}

	public void setIpAddressType(String ipAddressType) {
		this.ipAddressType = ipAddressType;
	}

	public String getLoadBalancerType() {
		return loadBalancerType;
	}

	public void setLoadBalancerType(String loadBalancerType) {
		this.loadBalancerType = loadBalancerType;
	}

	public Object getAvailabilityZones() {
		return availabilityZones;
	}

	public void setAvailabilityZones(Object availabilityZones) {
		this.availabilityZones = availabilityZones;
	}

	public Object getSecurityGroups() {
		return securityGroups;
	}

	public void setSecurityGroups(Object securityGroups) {
		this.securityGroups = securityGroups;
	}

	public String getLabels() {
		return labels;
	}

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

	public String getRegionName() {
		return regionName;
	}

	public void setRegionName(String regionName) {
		this.regionName = regionName;
	}

	public String getSpec() {
		return spec;
	}

	public void setSpec(String spec) {
		this.spec = spec;
	}

	public Long getResourceGroupId() {
		return resourceGroupId;
	}

	public void setResourceGroupId(Long resourceGroupId) {
		this.resourceGroupId = resourceGroupId;
	}

	public String getResourceGroupUuid() {
		return resourceGroupUuid;
	}

	public void setResourceGroupUuid(String resourceGroupUuid) {
		this.resourceGroupUuid = resourceGroupUuid;
	}

	public String getNetworkType() {
		return networkType;
	}

	public void setNetworkType(String networkType) {
		this.networkType = networkType;
	}

	public String getDeleteProtection() {
		return deleteProtection;
	}

	public void setDeleteProtection(String deleteProtection) {
		this.deleteProtection = deleteProtection;
	}

	public String getInternetChargeType() {
		return internetChargeType;
	}

	public void setInternetChargeType(String internetChargeType) {
		this.internetChargeType = internetChargeType;
	}

	public Long getBroadbandValue() {
		return broadbandValue;
	}

	public void setBroadbandValue(Long broadbandValue) {
		this.broadbandValue = broadbandValue;
	}

	public String getModificationProtection() {
		return modificationProtection;
	}

	public void setModificationProtection(String modificationProtection) {
		this.modificationProtection = modificationProtection;
	}

	public String getModificationProtectionReason() {
		return modificationProtectionReason;
	}

	public void setModificationProtectionReason(String modificationProtectionReason) {
		this.modificationProtectionReason = modificationProtectionReason;
	}

	public String getResourceGroupName() {
		return resourceGroupName;
	}

	public void setResourceGroupName(String resourceGroupName) {
		this.resourceGroupName = resourceGroupName;
	}

	public String getVipSubnetUuid() {
		return vipSubnetUuid;
	}

	public void setVipSubnetUuid(String vipSubnetUuid) {
		this.vipSubnetUuid = vipSubnetUuid;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public Date getExpiredTime() {
		return expiredTime;
	}

	public void setExpiredTime(Date expiredTime) {
		this.expiredTime = expiredTime;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public Catalog getCatalog() {
		return catalog;
	}

	public void setCatalog(Catalog catalog) {
		this.catalog = catalog;
	}

	public Long getBusinessId() {
		return businessId;
	}

	public void setBusinessId(Long businessId) {
		this.businessId = businessId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getBusinessName() {
		return businessName;
	}

	public void setBusinessName(String businessName) {
		this.businessName = businessName;
	}

	public String getCreatorName() {
		return creatorName;
	}

	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}

	public String getOwnerName() {
		return ownerName;
	}

	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

	public String getMenderName() {
		return menderName;
	}

	public void setMenderName(String menderName) {
		this.menderName = menderName;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	
}
