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;
import lombok.Data;

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

    @PK(value = PKStrategy.AUTO)
    private Long id;
    @Column("port_min")
    private Integer portMin;
    @Column("port_max")
    private Integer portMax;
    @Column("protocol")
    private String protocol;
    @Column("rule_uuid")
    private String ruleUuid;
    @Column("group_uuid")
    private String groupUuid;
    @Column("direction")
    private String direction;
    @Column("ether_type")
    private String etherType;
    @Column("remote_ip_prefix")
    private String remoteIpPrefix;
    @Column("remote_group_uuid")
    private String remoteGroupUuid;
    @Column("group_id")
    private Long groupId;
    @Column("vendor_id")
    private Long vendorId;
    @Column("tenant_id")
    private Long tenantId;// 租户ID
    @Column("project_id")
    private Long projectId;// 项目ID
    @IgnoreAll
    private String tenantName;// 所属租户
    @IgnoreAll
    private String projectName;//所属项目
    @Column("action")
    private String action;
    @Column("priority")
    private Integer priority;//优先级
    @Column("var1")
    private String var1;
    @Column("var2")
    private String var2;
    @Column("var3")
    private String var3;

    @Column("source_address_prefix")
    private String sourceAddressPrefix;//源地址前缀
    @Column("source_port_range")
    private String sourcePortRange;//源端口范围
    @Column("destination_address_prefix")
    private String destinationAddressPrefix;//目标地址前缀
    @Column("destination_port_range")
    private String destinationPortRange;//目标端口范围
    @Column("sgr_index")
    private Integer sgrIndex;//tce安全组规则下标
    @Column("tenant_uuid")
    private String tenantUuid;//OpenStack底层租户id
    @Column("default_rule")
    private Boolean defaultRule;
    //fc 纳管
    @Column("ip_ranges")
    private String ipRanges;
    @Column("ip_version")
    private String ipVersion;
    @Column("type")
    private String type;
    //fc 纳管


    public Boolean getDefaultRule() {
        return defaultRule;
    }

    public void setDefaultRule(Boolean defaultRule) {
        this.defaultRule = defaultRule;
    }

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

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

    /**
     * @return the portMin
     */
    public Integer getPortMin() {
        return portMin;
    }

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

    /**
     * @return the portMax
     */
    public Integer getPortMax() {
        return portMax;
    }

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

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

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

    /**
     * @return the ruleUuid
     */
    public String getRuleUuid() {
        return ruleUuid;
    }

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

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

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

    /**
     * @return the direction
     */
    public String getDirection() {
        return direction;
    }

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

    /**
     * @return the etherType
     */
    public String getEtherType() {
        return etherType;
    }

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

    /**
     * @return the remoteIpPrefix
     */
    public String getRemoteIpPrefix() {
        return remoteIpPrefix;
    }

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

    /**
     * @return the remoteGroupUuid
     */
    public String getRemoteGroupUuid() {
        return remoteGroupUuid;
    }

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

    /**
     * @return the groupId
     */
    public Long getGroupId() {
        return groupId;
    }

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

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

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

    public String getAction() {
        return action;
    }

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

    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public String getVar1() {
        return var1;
    }

    public void setVar1(String var1) {
        this.var1 = var1;
    }

    public String getVar2() {
        return var2;
    }

    public void setVar2(String var2) {
        this.var2 = var2;
    }

    public String getVar3() {
        return var3;
    }

    public void setVar3(String var3) {
        this.var3 = var3;
    }

    public String getSourceAddressPrefix() {
        return sourceAddressPrefix;
    }

    public void setSourceAddressPrefix(String sourceAddressPrefix) {
        this.sourceAddressPrefix = sourceAddressPrefix;
    }

    public String getSourcePortRange() {
        return sourcePortRange;
    }

    public void setSourcePortRange(String sourcePortRange) {
        this.sourcePortRange = sourcePortRange;
    }

    public String getDestinationAddressPrefix() {
        return destinationAddressPrefix;
    }

    public void setDestinationAddressPrefix(String destinationAddressPrefix) {
        this.destinationAddressPrefix = destinationAddressPrefix;
    }

    public String getDestinationPortRange() {
        return destinationPortRange;
    }

    public void setDestinationPortRange(String destinationPortRange) {
        this.destinationPortRange = destinationPortRange;
    }

    public Integer getSgrIndex() {
        return sgrIndex;
    }

    public void setSgrIndex(Integer sgrIndex) {
        this.sgrIndex = sgrIndex;
    }

    public String getTenantUuid() {
        return tenantUuid;
    }

    public void setTenantUuid(String tenantUuid) {
        this.tenantUuid = tenantUuid;
    }

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

}
