const QTYPE_NAMES: Record<number, string> = {
	1: "A",
	2: "NS",
	5: "CNAME",
	6: "SOA",
	12: "PTR",
	15: "MX",
	16: "TXT",
	28: "AAAA",
	33: "SRV",
	35: "NAPTR",
	43: "DS",
	46: "RRSIG",
	47: "NSEC",
	48: "DNSKEY",
	52: "TLSA",
	64: "SVCB",
	65: "HTTPS",
	255: "ANY",
	257: "CAA",
};

/** DNS type name for common codes, `TYPE<n>` fallback (RFC 3597 style), em dash for null. */
export function qtypeName(qtype: number | null): string {
	if (qtype === null) return "—";
	return QTYPE_NAMES[qtype] ?? `TYPE${qtype}`;
}
