package com.bocloud.ims.entity.resource;

import com.bocloud.common.utils.DateSerializer;
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;

/**
 * 安全组实体类
 *
 * @author weiwei
 */
@Table("security_group")
public class SecurityGroup extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id;
	@Column("group_uuid")
	private String groupUuid;
	@Column("tenant_uuid")
	private String tenantUuid;
	@Column("create_time")
	@JsonSerialize(using = DateSerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	@Column("request_id")
	private String requestId;
	@Column("vendor_id")
	private Long vendorId;
	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("project_id")
	private Long projectId;// 项目ID
	@Column("user_id")
	private Long userId;
	@Column("zone_id")
	private String zoneId;
	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String tenantName;// 所属租户
	@IgnoreAll
	private String vendorType;// 平台类型
	@IgnoreAll
	private String projectName;// 所属项目
	@IgnoreAll
	private String projectVisibility;
	@Column("region_id")
	private String regionId;
	@IgnoreAll
	private String regionName;
	@Column("vpc_id")
	private Long vpcId;
	@Column("vpc_uuid")
	private String vpcUuid;
	@Column("azure_resource_group_name")
	private String azureResourceGroupName; // azure 资源组名称
	@Column("resource_group_id")
	private Long resourceGroupId;
	@Column("aws_group_name")
	private String awsGroupName; // aws 组名
	@Column("instance_count")
	private Integer instanceCount;

	@IgnoreAll
	private String vpcName;
	@IgnoreAll
	private String category;
	@IgnoreAll
	private String securityGroupType;
	@IgnoreAll
	private String resourceGroupUuid;
	@IgnoreAll
	private String osTenantName;
	@IgnoreAll
	private String zoneName;
	@IgnoreAll
	private String networkInterfaceNames;

	public String getNetworkInterfaceNames() {
		return networkInterfaceNames;
	}

	public void setNetworkInterfaceNames(String networkInterfaceNames) {
		this.networkInterfaceNames = networkInterfaceNames;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getResourceGroupId() {
		return resourceGroupId;
	}

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

	public String getRegionId() {
		return regionId;
	}

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

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

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

	/**
	 * @return the groupUuid
	 */
	public String getGroupUuid() {
		return groupUuid;
	}

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

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

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

	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

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

	/**
	 * @return the requestId
	 */
	public String getRequestId() {
		return requestId;
	}

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

	/**
	 * @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 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 String getProjectName() {
		return projectName;
	}

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

	public SecurityGroup() {
		super();
	}

	public SecurityGroup(String name, String remark) {
		super();
		this.setName(name);
		this.setRemark(remark);
	}

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

	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 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 getVpcName() {
		return vpcName;
	}

	public void setVpcName(String vpcName) {
		this.vpcName = vpcName;
	}

	public String getVendorType() {
		return vendorType;
	}

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

	public String getAzureResourceGroupName() {
		return azureResourceGroupName;
	}

	public void setAzureResourceGroupName(String azureResourceGroupName) {
		this.azureResourceGroupName = azureResourceGroupName;
	}

	public String getAwsGroupName() {
		return awsGroupName;
	}

	public void setAwsGroupName(String awsGroupName) {
		this.awsGroupName = awsGroupName;
	}

	public String getOsTenantName() {
		return osTenantName;
	}

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

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getSecurityGroupType() {
		return securityGroupType;
	}

	public void setSecurityGroupType(String securityGroupType) {
		this.securityGroupType = securityGroupType;
	}

	public String getResourceGroupUuid() {
		return resourceGroupUuid;
	}

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

	public String getZoneId() {
		return zoneId;
	}

	public void setZoneId(String zoneId) {
		this.zoneId = zoneId;
	}

	public String getZoneName() {
		return zoneName;
	}

	public void setZoneName(String zoneName) {
		this.zoneName = zoneName;
	}

	public Integer getInstanceCount() {
		return instanceCount;
	}

	public void setInstanceCount(Integer instanceCount) {
		this.instanceCount = instanceCount;
	}
}
