package com.bocloud.ims.entity.resource;

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;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 路由
 *
 * @author oywl
 */
@Table("router")
public class Router extends GenericEntity {
	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("router_uuid")
	private String routerUuid;// 路由uuid
	@Column("admin_stateup")
	private Boolean adminStateup;// 管理员状态
	@Column("network_uuid")
	private String networkUuid;// 网关端口ID
	@Column("enable_snat")
	private Boolean enableSnat;// snat 有snat true， 默认tr
	@Column("ha")
	private Boolean ha;// 高可用
	@Column("availability_zones")
	private String availabilityZones;// 可用域
	@Column("project_uuid")
	private String projectUuid;
	@Column("tenant_uuid")
	private String tenantUuid;
	@Column("vendor_id")
	private Long vendorId; // 云供应商ID
	@Column("network_id")
	private Long networkId; // 网络ID
	@Column("firewall_id")
	private Long firewallId;// 防火墙ID
	@Column("firewall_uuid")
	private String firewallUuid;// 防火墙UUID
	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("project_id")
	private Long projectId;// 项目ID
	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String networkName;// 网络名称
	@IgnoreAll
	private String tenantName;// 所属租户
	@IgnoreAll
	private String projectName;// 所属项目
	@IgnoreAll
	private String projectVisibility;
	@IgnoreAll
	private String targetName;// 租户用户
	@IgnoreAll
	@JsonSerialize(using = DaySerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date expiredTime;// 过期时间
	@Column("guid")
	private String guid;// 全局唯一标识
	@Column("region_id")
	private String regionId;
	@IgnoreAll
	private String regionName;
	@IgnoreAll
	private String osTenantName;
	@Column("vpc_id")
	private Long vpcId;

	@Column("route_table_ids")
	private String routeTableIds;

	@IgnoreAll
	private List<Subnet> subnets;
	@IgnoreAll
	@Column("vendor_type")
	private String vendorType;
	@Column("router_table_id")
	private Long routerTableId;//路由表Id
	@Column("resource_group_Id")
	private Long resourceGroupId;//资源组id

	public Long getRouterTableId() {
		return routerTableId;
	}

	public void setRouterTableId(Long routerTableId) {
		this.routerTableId = routerTableId;
	}

	public Long getResourceGroupId() {
		return resourceGroupId;
	}

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

	public Router() {
		super();
	}

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

	/**
	 * @param routerUuid
	 * @param adminStateup
	 * @param networkUuid
	 * @param enableSnat
	 * @param ha
	 * @param availabilityZones
	 * @param projectUuid
	 * @param tenantUuid
	 * @param vendorId
	 * @param networkId
	 * @param firewallId
	 * @param firewallUuid
	 */
	public Router(String routerUuid, Boolean adminStateup, String networkUuid, Boolean enableSnat, Boolean ha,
			String availabilityZones, String projectUuid, String tenantUuid, Long vendorId, Long networkId,
			Long firewallId, String firewallUuid) {
		super();
		this.routerUuid = routerUuid;
		this.adminStateup = adminStateup;
		this.networkUuid = networkUuid;
		this.enableSnat = enableSnat;
		this.ha = ha;
		this.availabilityZones = availabilityZones;
		this.projectUuid = projectUuid;
		this.tenantUuid = tenantUuid;
		this.vendorId = vendorId;
		this.networkId = networkId;
		this.firewallId = firewallId;
		this.firewallUuid = firewallUuid;
	}

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

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

	/**
	 * @return the routerUuid
	 */
	public String getRouterUuid() {
		return routerUuid;
	}

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

	/**
	 * @return the adminStateup
	 */
	public Boolean getAdminStateup() {
		return adminStateup;
	}

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

	/**
	 * @return the networkUuid
	 */
	public String getNetworkUuid() {
		return networkUuid;
	}

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

	/**
	 * @return the enableSnat
	 */
	public Boolean getEnableSnat() {
		return enableSnat;
	}

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

	/**
	 * @return the ha
	 */
	public Boolean getHa() {
		return ha;
	}

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

	/**
	 * @return the availabilityZones
	 */
	public String getAvailabilityZones() {
		return availabilityZones;
	}

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

	/**
	 * @return the projectUuid
	 */
	public String getProjectUuid() {
		return projectUuid;
	}

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

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

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

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

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

	/**
	 * @return the networkId
	 */
	public Long getNetworkId() {
		return networkId;
	}

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

	/**
	 * @return the firewallId
	 */
	public Long getFirewallId() {
		return firewallId;
	}

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

	/**
	 * @return the firewallUuid
	 */
	public String getFirewallUuid() {
		return firewallUuid;
	}

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

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

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

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

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

	/**
	 * @return the networkName
	 */
	public String getNetworkName() {
		return networkName;
	}

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

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

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

	/**
	 * @return the expiredTime
	 */
	public Date getExpiredTime() {
		return expiredTime;
	}

	/**
	 * @param expiredTime the expiredTime to set
	 */
	public void setExpiredTime(Date expiredTime) {
		this.expiredTime = expiredTime;
	}

	/**
	 * @return the guid
	 */
	public String getGuid() {
		return guid;
	}

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

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

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

	public String getProjectName() {
		return projectName;
	}

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

	public String getTargetName() {
		return targetName;
	}

	public void setTargetName(String targetName) {
		this.targetName = targetName;
	}

	public String getRegionId() {
		return regionId;
	}

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

	public List<Subnet> getSubnets() {
		return subnets;
	}

	public void setSubnets(List<Subnet> subnets) {
		this.subnets = subnets;
	}

	public String getRegionName() {
		return regionName;
	}

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

	public String getProjectVisibility() {
		return projectVisibility;
	}

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

	public String getOsTenantName() {
		return osTenantName;
	}

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

	public Long getVpcId() {
		return vpcId;
	}

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

	public String getVendorType() {
		return vendorType;
	}

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

	public String getRouteTableIds() {
		return routeTableIds;
	}

	public void setRouteTableIds(String routeTableIds) {
		this.routeTableIds = routeTableIds;
	}

}
