///|
/// Offline snapshot of the core IANA SDP Parameters registries.
///
/// The snapshot intentionally contains only names needed for deterministic
/// recognition. Runtime parsing never downloads or resolves anything.
pub fn registry_snapshot_date() -> String {
  "2026-06-01"
}

///|
pub fn registered_media_types() -> Array[String] {
  ["audio", "video", "text", "application", "message", "image", "haptics"]
}

///|
pub fn registered_network_types() -> Array[String] {
  ["IN"]
}

///|
pub fn registered_address_types() -> Array[String] {
  ["IP4", "IP6"]
}

///|
pub fn registered_bandwidth_types() -> Array[String] {
  ["CT", "AS", "TIAS", "RS", "RR"]
}

///|
pub fn registered_protocols() -> Array[String] {
  [
    "RTP/AVP", "udp", "vat", "rtp", "UDPTL", "TCP", "RTP/AVPF", "TCP/RTP/AVP", "RTP/SAVP",
    "TCP/BFCP", "TCP/TLS/BFCP", "RTP/SAVPF", "UDP/TLS/RTP/SAVP", "UDP/TLS/RTP/SAVPF",
    "TCP/TLS/RTP/SAVP", "TCP/TLS/RTP/SAVPF", "SCTP", "SCTP/DTLS", "UDP/DTLS/SCTP",
    "TCP/DTLS/SCTP", "DTLS/SCTP", "DCCP", "DCCP/RTP/AVP", "DCCP/RTP/SAVP", "DCCP/RTP/AVPF",
    "DCCP/RTP/SAVPF",
  ]
}

///|
pub fn registered_attribute_names() -> Array[String] {
  [
    "cat", "keywds", "tool", "ptime", "maxptime", "rtpmap", "recvonly", "sendrecv",
    "sendonly", "inactive", "orient", "type", "charset", "sdplang", "lang", "framerate",
    "quality", "fmtp", "source-filter", "rtcp", "rtcp-fb", "rtcp-xr", "rtcp-mux",
    "rtcp-mux-only", "mid", "group", "msid", "msid-semantic", "ssrc", "ssrc-group",
    "setup", "connection", "fingerprint", "ice-ufrag", "ice-pwd", "ice-options",
    "candidate", "remote-candidates", "end-of-candidates", "bundle-only", "extmap",
    "extmap-allow-mixed", "rid", "simulcast", "sctp-port", "max-message-size", "label",
    "dcmap", "dcsa", "content", "floorid", "confid", "curr", "des", "tcap", "acap",
    "pcfg", "csup", "creq", "cmed", "acfg", "lcfg", "icap", "rmcap", "rmed", "mfcap",
    "mptime",
  ]
}

///|
pub fn static_rtp_payload_name(payload : Int) -> String? {
  match payload {
    0 => Some("PCMU/8000")
    3 => Some("GSM/8000")
    4 => Some("G723/8000")
    5 => Some("DVI4/8000")
    6 => Some("DVI4/16000")
    7 => Some("LPC/8000")
    8 => Some("PCMA/8000")
    9 => Some("G722/8000")
    10 => Some("L16/44100/2")
    11 => Some("L16/44100/1")
    12 => Some("QCELP/8000")
    13 => Some("CN/8000")
    14 => Some("MPA/90000")
    15 => Some("G728/8000")
    16 => Some("DVI4/11025")
    17 => Some("DVI4/22050")
    18 => Some("G729/8000")
    25 => Some("CelB/90000")
    26 => Some("JPEG/90000")
    28 => Some("nv/90000")
    31 => Some("H261/90000")
    32 => Some("MPV/90000")
    33 => Some("MP2T/90000")
    34 => Some("H263/90000")
    _ => None
  }
}

///|
pub fn is_registered_media(value : String) -> Bool {
  string_in(registered_media_types(), ascii_lower(value))
}

///|
pub fn is_registered_protocol(value : String) -> Bool {
  for item in registered_protocols() {
    if item.equal_ignore_ascii_case(value) {
      return true
    }
  }
  false
}

///|
pub fn is_registered_attribute(value : String) -> Bool {
  string_in(registered_attribute_names(), ascii_lower(value))
}

///|
pub fn is_registered_bandwidth(value : String) -> Bool {
  for item in registered_bandwidth_types() {
    if item.equal_ignore_ascii_case(value) {
      return true
    }
  }
  false
}

///|
pub fn is_rtp_protocol(value : String) -> Bool {
  value.to_upper().contains("RTP/")
}