package com.bocloud.nms.model.hillstone;

import java.util.Objects;
import java.util.Optional;

public class ARPBindModel extends HillStoneGenericModel {
    private Long vendorId; // 所属平台
    private Long ipAddr; // 绑定IP
    private String macAddr; // mac
    private String vrName; // 虚拟路由器
    private String description; // mac描述
    private Integer type; // 1->绑定为静态条目 启用后隐藏 0-> 不绑定，显示
    private Integer authenticated;  // ARP认证 0->启用； 1->不启用
    private String interfaceName; // 接口

    public Long getVendorId() {
        return vendorId;
    }

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

    public Long getIpAddr() {
        return ipAddr;
    }

    public void setIpAddr(Long ipAddr) {
        this.ipAddr = ipAddr;
    }

    public String getMacAddr() {
        return macAddr;
    }

    public void setMacAddr(String macAddr) {
        this.macAddr = macAddr;
    }

    public String getVrName() {
        return vrName;
    }

    public void setVrName(String vrName) {
        this.vrName = vrName;
    }

    public String getDescription() {
        return description;
    }

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

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getAuthenticated() {
        return authenticated;
    }

    public void setAuthenticated(Integer authenticated) {
        this.authenticated = authenticated;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }

    public String getIpAddrString() {
        return Optional.ofNullable(this.getIpAddr()).map(Ipv4::convertIp).orElse(null);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ARPBindModel arpBind = (ARPBindModel) o;
        return Objects.equals(vendorId, arpBind.vendorId) &&
            Objects.equals(macAddr, arpBind.macAddr) &&
            Objects.equals(ipAddr, arpBind.ipAddr);
    }

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