package com.ff.base.enums;

import lombok.Getter;

@Getter
public enum DnsRecordType {
    A(1, "A"),
    AAAA(2, "AAAA"),
    CNAME(3, "CNAME"),
    TXT(4, "TXT"),
    MX(5, "MX"),
    SRV(6, "SRV"),
    NS(7, "NS");

    private final Integer value;
    private final String name;

    DnsRecordType(Integer value, String name) {
        this.value = value;
        this.name = name;
    }


    /**
     * 按值获取名称
     *
     * @param value 价值
     * @return {@link String }
     */
    public static String getNameByValue(Integer value) {
        for (DnsRecordType type : DnsRecordType.values()) {
            if (type.getValue().equals(value)) {
                return type.getName();
            }
        }
        return null;
    }
}