package com.bocloud.nms.model.hillstone;

import java.util.List;
import java.util.Objects;

// 安全策略
public class SecurityPolicyModel extends HillStoneGenericModel {
    private Long vendorId; // 所属平台
    private Long srcZoneId; // 源安全域id
    private String srcZone; // 源安全域
    private List<RelationModel> srcAddrs; // 源地址--地址本
    private List<RelationModel> dstAddrs; // 目的地址--地址簿
    private String srcSubnets; // 源地址--IP/掩码，格式：1.1.1.1/24,2.2.2.2/24
    private String srcRanges; // 源地址--IP范围，格式：1.1.1.1-1.1.1.254,1.1.2.1-1.1.2.254
    private String srcHosts; // 源地址--主机名称，格式：json，String[]
    private Long dstZoneId; // 目的安全域id
    private String dstZone; // 目的安全域
    private String dstSubnets; // 目的地址--IP/掩码，格式：1.1.1.1/24,2.2.2.2/24
    private String dstRanges; // 目的地址--IP范围，格式：1.1.1.1-1.1.1.254,1.1.2.1-1.1.2.254
    private String dstHosts; // 目的地址--主机名称，格式：json，tring[]
    private Long policyId; // 策略id
    private String name; // 名称
    private String description; // 描述
    private List<RelationModel> services; // 服务/服务组
    private List<RelationModel> applications; // 应用/应用组/应用过滤组
    private Integer action; // 操作 1->拒绝；2->允许；5->安全连接
    private Long hitCount; // 命中数

    // TODO: 2020/11/19 缺点东西
    public Long getVendorId() {
        return vendorId;
    }

    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    public Long getSrcZoneId() {
        return srcZoneId;
    }

    public void setSrcZoneId(Long srcZoneId) {
        this.srcZoneId = srcZoneId;
    }

    public String getSrcZone() {
        return srcZone;
    }

    public void setSrcZone(String srcZone) {
        this.srcZone = srcZone;
    }

    public List<RelationModel> getSrcAddrs() {
        return srcAddrs;
    }

    public void setSrcAddrs(List<RelationModel> srcAddrs) {
        this.srcAddrs = srcAddrs;
    }

    public String getSrcSubnets() {
        return srcSubnets;
    }

    public void setSrcSubnets(String srcSubnets) {
        this.srcSubnets = srcSubnets;
    }

    public String getSrcRanges() {
        return srcRanges;
    }

    public void setSrcRanges(String srcRanges) {
        this.srcRanges = srcRanges;
    }

    public String getSrcHosts() {
        return srcHosts;
    }

    public void setSrcHosts(String srcHosts) {
        this.srcHosts = srcHosts;
    }

    public Long getDstZoneId() {
        return dstZoneId;
    }

    public void setDstZoneId(Long dstZoneId) {
        this.dstZoneId = dstZoneId;
    }

    public String getDstZone() {
        return dstZone;
    }

    public void setDstZone(String dstZone) {
        this.dstZone = dstZone;
    }

    public List<RelationModel> getDstAddrs() {
        return dstAddrs;
    }

    public void setDstAddrs(List<RelationModel> dstAddrs) {
        this.dstAddrs = dstAddrs;
    }

    public String getDstSubnets() {
        return dstSubnets;
    }

    public void setDstSubnets(String dstSubnets) {
        this.dstSubnets = dstSubnets;
    }

    public String getDstRanges() {
        return dstRanges;
    }

    public void setDstRanges(String dstRanges) {
        this.dstRanges = dstRanges;
    }

    public String getDstHosts() {
        return dstHosts;
    }

    public void setDstHosts(String dstHosts) {
        this.dstHosts = dstHosts;
    }

    public Long getPolicyId() {
        return policyId;
    }

    public void setPolicyId(Long policyId) {
        this.policyId = policyId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<RelationModel> getServices() {
        return services;
    }

    public void setServices(List<RelationModel> services) {
        this.services = services;
    }

    public List<RelationModel> getApplications() {
        return applications;
    }

    public void setApplications(List<RelationModel> applications) {
        this.applications = applications;
    }

    public Integer getAction() {
        return action;
    }

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

    public Long getHitCount() {
        return hitCount;
    }

    public void setHitCount(Long hitCount) {
        this.hitCount = hitCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SecurityPolicyModel that = (SecurityPolicyModel) o;
        return Objects.equals(vendorId, that.vendorId) &&
            Objects.equals(policyId, that.policyId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(vendorId, policyId);
    }
}
