// Generated by tools/generate-schema.py. Do not edit by hand.
// Schema derived from spec/amqp0-9-1.stripped.extended.xml.
// BSD copyright, conditions and disclaimer: see THIRD_PARTY.md and the XML.

///|
pub fn method_spec(class_id : Int, method_id : Int) -> MethodSpec? {
  match (class_id, method_id) {
    (10, 10) =>
      Some({
        class_id: 10,
        method_id: 10,
        name: "connection.start",
        fields: [
          ("version-major", OctetKind),
          ("version-minor", OctetKind),
          ("server-properties", TableKind),
          ("mechanisms", LongStringKind),
          ("locales", LongStringKind),
        ],
        carries_content: false,
      })
    (10, 11) =>
      Some({
        class_id: 10,
        method_id: 11,
        name: "connection.start-ok",
        fields: [
          ("client-properties", TableKind),
          ("mechanism", ShortStringKind),
          ("response", LongStringKind),
          ("locale", ShortStringKind),
        ],
        carries_content: false,
      })
    (10, 20) =>
      Some({
        class_id: 10,
        method_id: 20,
        name: "connection.secure",
        fields: [("challenge", LongStringKind)],
        carries_content: false,
      })
    (10, 21) =>
      Some({
        class_id: 10,
        method_id: 21,
        name: "connection.secure-ok",
        fields: [("response", LongStringKind)],
        carries_content: false,
      })
    (10, 30) =>
      Some({
        class_id: 10,
        method_id: 30,
        name: "connection.tune",
        fields: [
          ("channel-max", ShortKind),
          ("frame-max", LongKind),
          ("heartbeat", ShortKind),
        ],
        carries_content: false,
      })
    (10, 31) =>
      Some({
        class_id: 10,
        method_id: 31,
        name: "connection.tune-ok",
        fields: [
          ("channel-max", ShortKind),
          ("frame-max", LongKind),
          ("heartbeat", ShortKind),
        ],
        carries_content: false,
      })
    (10, 40) =>
      Some({
        class_id: 10,
        method_id: 40,
        name: "connection.open",
        fields: [
          ("virtual-host", ShortStringKind),
          ("reserved-1", ShortStringKind),
          ("reserved-2", BitKind),
        ],
        carries_content: false,
      })
    (10, 41) =>
      Some({
        class_id: 10,
        method_id: 41,
        name: "connection.open-ok",
        fields: [("reserved-1", ShortStringKind)],
        carries_content: false,
      })
    (10, 50) =>
      Some({
        class_id: 10,
        method_id: 50,
        name: "connection.close",
        fields: [
          ("reply-code", ShortKind),
          ("reply-text", ShortStringKind),
          ("class-id", ShortKind),
          ("method-id", ShortKind),
        ],
        carries_content: false,
      })
    (10, 51) =>
      Some({
        class_id: 10,
        method_id: 51,
        name: "connection.close-ok",
        fields: [],
        carries_content: false,
      })
    (10, 60) =>
      Some({
        class_id: 10,
        method_id: 60,
        name: "connection.blocked",
        fields: [("reason", ShortStringKind)],
        carries_content: false,
      })
    (10, 61) =>
      Some({
        class_id: 10,
        method_id: 61,
        name: "connection.unblocked",
        fields: [],
        carries_content: false,
      })
    (10, 70) =>
      Some({
        class_id: 10,
        method_id: 70,
        name: "connection.update-secret",
        fields: [("new-secret", LongStringKind), ("reason", ShortStringKind)],
        carries_content: false,
      })
    (10, 71) =>
      Some({
        class_id: 10,
        method_id: 71,
        name: "connection.update-secret-ok",
        fields: [],
        carries_content: false,
      })
    (20, 10) =>
      Some({
        class_id: 20,
        method_id: 10,
        name: "channel.open",
        fields: [("reserved-1", ShortStringKind)],
        carries_content: false,
      })
    (20, 11) =>
      Some({
        class_id: 20,
        method_id: 11,
        name: "channel.open-ok",
        fields: [("reserved-1", LongStringKind)],
        carries_content: false,
      })
    (20, 20) =>
      Some({
        class_id: 20,
        method_id: 20,
        name: "channel.flow",
        fields: [("active", BitKind)],
        carries_content: false,
      })
    (20, 21) =>
      Some({
        class_id: 20,
        method_id: 21,
        name: "channel.flow-ok",
        fields: [("active", BitKind)],
        carries_content: false,
      })
    (20, 40) =>
      Some({
        class_id: 20,
        method_id: 40,
        name: "channel.close",
        fields: [
          ("reply-code", ShortKind),
          ("reply-text", ShortStringKind),
          ("class-id", ShortKind),
          ("method-id", ShortKind),
        ],
        carries_content: false,
      })
    (20, 41) =>
      Some({
        class_id: 20,
        method_id: 41,
        name: "channel.close-ok",
        fields: [],
        carries_content: false,
      })
    (40, 10) =>
      Some({
        class_id: 40,
        method_id: 10,
        name: "exchange.declare",
        fields: [
          ("reserved-1", ShortKind),
          ("exchange", ShortStringKind),
          ("type", ShortStringKind),
          ("passive", BitKind),
          ("durable", BitKind),
          ("auto-delete", BitKind),
          ("internal", BitKind),
          ("no-wait", BitKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (40, 11) =>
      Some({
        class_id: 40,
        method_id: 11,
        name: "exchange.declare-ok",
        fields: [],
        carries_content: false,
      })
    (40, 20) =>
      Some({
        class_id: 40,
        method_id: 20,
        name: "exchange.delete",
        fields: [
          ("reserved-1", ShortKind),
          ("exchange", ShortStringKind),
          ("if-unused", BitKind),
          ("no-wait", BitKind),
        ],
        carries_content: false,
      })
    (40, 21) =>
      Some({
        class_id: 40,
        method_id: 21,
        name: "exchange.delete-ok",
        fields: [],
        carries_content: false,
      })
    (40, 30) =>
      Some({
        class_id: 40,
        method_id: 30,
        name: "exchange.bind",
        fields: [
          ("reserved-1", ShortKind),
          ("destination", ShortStringKind),
          ("source", ShortStringKind),
          ("routing-key", ShortStringKind),
          ("no-wait", BitKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (40, 31) =>
      Some({
        class_id: 40,
        method_id: 31,
        name: "exchange.bind-ok",
        fields: [],
        carries_content: false,
      })
    (40, 40) =>
      Some({
        class_id: 40,
        method_id: 40,
        name: "exchange.unbind",
        fields: [
          ("reserved-1", ShortKind),
          ("destination", ShortStringKind),
          ("source", ShortStringKind),
          ("routing-key", ShortStringKind),
          ("no-wait", BitKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (40, 51) =>
      Some({
        class_id: 40,
        method_id: 51,
        name: "exchange.unbind-ok",
        fields: [],
        carries_content: false,
      })
    (50, 10) =>
      Some({
        class_id: 50,
        method_id: 10,
        name: "queue.declare",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("passive", BitKind),
          ("durable", BitKind),
          ("exclusive", BitKind),
          ("auto-delete", BitKind),
          ("no-wait", BitKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (50, 11) =>
      Some({
        class_id: 50,
        method_id: 11,
        name: "queue.declare-ok",
        fields: [
          ("queue", ShortStringKind),
          ("message-count", LongKind),
          ("consumer-count", LongKind),
        ],
        carries_content: false,
      })
    (50, 20) =>
      Some({
        class_id: 50,
        method_id: 20,
        name: "queue.bind",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("exchange", ShortStringKind),
          ("routing-key", ShortStringKind),
          ("no-wait", BitKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (50, 21) =>
      Some({
        class_id: 50,
        method_id: 21,
        name: "queue.bind-ok",
        fields: [],
        carries_content: false,
      })
    (50, 50) =>
      Some({
        class_id: 50,
        method_id: 50,
        name: "queue.unbind",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("exchange", ShortStringKind),
          ("routing-key", ShortStringKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (50, 51) =>
      Some({
        class_id: 50,
        method_id: 51,
        name: "queue.unbind-ok",
        fields: [],
        carries_content: false,
      })
    (50, 30) =>
      Some({
        class_id: 50,
        method_id: 30,
        name: "queue.purge",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("no-wait", BitKind),
        ],
        carries_content: false,
      })
    (50, 31) =>
      Some({
        class_id: 50,
        method_id: 31,
        name: "queue.purge-ok",
        fields: [("message-count", LongKind)],
        carries_content: false,
      })
    (50, 40) =>
      Some({
        class_id: 50,
        method_id: 40,
        name: "queue.delete",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("if-unused", BitKind),
          ("if-empty", BitKind),
          ("no-wait", BitKind),
        ],
        carries_content: false,
      })
    (50, 41) =>
      Some({
        class_id: 50,
        method_id: 41,
        name: "queue.delete-ok",
        fields: [("message-count", LongKind)],
        carries_content: false,
      })
    (60, 10) =>
      Some({
        class_id: 60,
        method_id: 10,
        name: "basic.qos",
        fields: [
          ("prefetch-size", LongKind),
          ("prefetch-count", ShortKind),
          ("global", BitKind),
        ],
        carries_content: false,
      })
    (60, 11) =>
      Some({
        class_id: 60,
        method_id: 11,
        name: "basic.qos-ok",
        fields: [],
        carries_content: false,
      })
    (60, 20) =>
      Some({
        class_id: 60,
        method_id: 20,
        name: "basic.consume",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("consumer-tag", ShortStringKind),
          ("no-local", BitKind),
          ("no-ack", BitKind),
          ("exclusive", BitKind),
          ("no-wait", BitKind),
          ("arguments", TableKind),
        ],
        carries_content: false,
      })
    (60, 21) =>
      Some({
        class_id: 60,
        method_id: 21,
        name: "basic.consume-ok",
        fields: [("consumer-tag", ShortStringKind)],
        carries_content: false,
      })
    (60, 30) =>
      Some({
        class_id: 60,
        method_id: 30,
        name: "basic.cancel",
        fields: [("consumer-tag", ShortStringKind), ("no-wait", BitKind)],
        carries_content: false,
      })
    (60, 31) =>
      Some({
        class_id: 60,
        method_id: 31,
        name: "basic.cancel-ok",
        fields: [("consumer-tag", ShortStringKind)],
        carries_content: false,
      })
    (60, 40) =>
      Some({
        class_id: 60,
        method_id: 40,
        name: "basic.publish",
        fields: [
          ("reserved-1", ShortKind),
          ("exchange", ShortStringKind),
          ("routing-key", ShortStringKind),
          ("mandatory", BitKind),
          ("immediate", BitKind),
        ],
        carries_content: true,
      })
    (60, 50) =>
      Some({
        class_id: 60,
        method_id: 50,
        name: "basic.return",
        fields: [
          ("reply-code", ShortKind),
          ("reply-text", ShortStringKind),
          ("exchange", ShortStringKind),
          ("routing-key", ShortStringKind),
        ],
        carries_content: true,
      })
    (60, 60) =>
      Some({
        class_id: 60,
        method_id: 60,
        name: "basic.deliver",
        fields: [
          ("consumer-tag", ShortStringKind),
          ("delivery-tag", LongLongKind),
          ("redelivered", BitKind),
          ("exchange", ShortStringKind),
          ("routing-key", ShortStringKind),
        ],
        carries_content: true,
      })
    (60, 70) =>
      Some({
        class_id: 60,
        method_id: 70,
        name: "basic.get",
        fields: [
          ("reserved-1", ShortKind),
          ("queue", ShortStringKind),
          ("no-ack", BitKind),
        ],
        carries_content: false,
      })
    (60, 71) =>
      Some({
        class_id: 60,
        method_id: 71,
        name: "basic.get-ok",
        fields: [
          ("delivery-tag", LongLongKind),
          ("redelivered", BitKind),
          ("exchange", ShortStringKind),
          ("routing-key", ShortStringKind),
          ("message-count", LongKind),
        ],
        carries_content: true,
      })
    (60, 72) =>
      Some({
        class_id: 60,
        method_id: 72,
        name: "basic.get-empty",
        fields: [("reserved-1", ShortStringKind)],
        carries_content: false,
      })
    (60, 80) =>
      Some({
        class_id: 60,
        method_id: 80,
        name: "basic.ack",
        fields: [("delivery-tag", LongLongKind), ("multiple", BitKind)],
        carries_content: false,
      })
    (60, 90) =>
      Some({
        class_id: 60,
        method_id: 90,
        name: "basic.reject",
        fields: [("delivery-tag", LongLongKind), ("requeue", BitKind)],
        carries_content: false,
      })
    (60, 100) =>
      Some({
        class_id: 60,
        method_id: 100,
        name: "basic.recover-async",
        fields: [("requeue", BitKind)],
        carries_content: false,
      })
    (60, 110) =>
      Some({
        class_id: 60,
        method_id: 110,
        name: "basic.recover",
        fields: [("requeue", BitKind)],
        carries_content: false,
      })
    (60, 111) =>
      Some({
        class_id: 60,
        method_id: 111,
        name: "basic.recover-ok",
        fields: [],
        carries_content: false,
      })
    (60, 120) =>
      Some({
        class_id: 60,
        method_id: 120,
        name: "basic.nack",
        fields: [
          ("delivery-tag", LongLongKind),
          ("multiple", BitKind),
          ("requeue", BitKind),
        ],
        carries_content: false,
      })
    (90, 10) =>
      Some({
        class_id: 90,
        method_id: 10,
        name: "tx.select",
        fields: [],
        carries_content: false,
      })
    (90, 11) =>
      Some({
        class_id: 90,
        method_id: 11,
        name: "tx.select-ok",
        fields: [],
        carries_content: false,
      })
    (90, 20) =>
      Some({
        class_id: 90,
        method_id: 20,
        name: "tx.commit",
        fields: [],
        carries_content: false,
      })
    (90, 21) =>
      Some({
        class_id: 90,
        method_id: 21,
        name: "tx.commit-ok",
        fields: [],
        carries_content: false,
      })
    (90, 30) =>
      Some({
        class_id: 90,
        method_id: 30,
        name: "tx.rollback",
        fields: [],
        carries_content: false,
      })
    (90, 31) =>
      Some({
        class_id: 90,
        method_id: 31,
        name: "tx.rollback-ok",
        fields: [],
        carries_content: false,
      })
    (85, 10) =>
      Some({
        class_id: 85,
        method_id: 10,
        name: "confirm.select",
        fields: [("nowait", BitKind)],
        carries_content: false,
      })
    (85, 11) =>
      Some({
        class_id: 85,
        method_id: 11,
        name: "confirm.select-ok",
        fields: [],
        carries_content: false,
      })
    _ => None
  }
}

///|
pub fn method_spec_by_name(name : String) -> MethodSpec? {
  match name {
    "connection.start" => method_spec(10, 10)
    "connection.start-ok" => method_spec(10, 11)
    "connection.secure" => method_spec(10, 20)
    "connection.secure-ok" => method_spec(10, 21)
    "connection.tune" => method_spec(10, 30)
    "connection.tune-ok" => method_spec(10, 31)
    "connection.open" => method_spec(10, 40)
    "connection.open-ok" => method_spec(10, 41)
    "connection.close" => method_spec(10, 50)
    "connection.close-ok" => method_spec(10, 51)
    "connection.blocked" => method_spec(10, 60)
    "connection.unblocked" => method_spec(10, 61)
    "connection.update-secret" => method_spec(10, 70)
    "connection.update-secret-ok" => method_spec(10, 71)
    "channel.open" => method_spec(20, 10)
    "channel.open-ok" => method_spec(20, 11)
    "channel.flow" => method_spec(20, 20)
    "channel.flow-ok" => method_spec(20, 21)
    "channel.close" => method_spec(20, 40)
    "channel.close-ok" => method_spec(20, 41)
    "exchange.declare" => method_spec(40, 10)
    "exchange.declare-ok" => method_spec(40, 11)
    "exchange.delete" => method_spec(40, 20)
    "exchange.delete-ok" => method_spec(40, 21)
    "exchange.bind" => method_spec(40, 30)
    "exchange.bind-ok" => method_spec(40, 31)
    "exchange.unbind" => method_spec(40, 40)
    "exchange.unbind-ok" => method_spec(40, 51)
    "queue.declare" => method_spec(50, 10)
    "queue.declare-ok" => method_spec(50, 11)
    "queue.bind" => method_spec(50, 20)
    "queue.bind-ok" => method_spec(50, 21)
    "queue.unbind" => method_spec(50, 50)
    "queue.unbind-ok" => method_spec(50, 51)
    "queue.purge" => method_spec(50, 30)
    "queue.purge-ok" => method_spec(50, 31)
    "queue.delete" => method_spec(50, 40)
    "queue.delete-ok" => method_spec(50, 41)
    "basic.qos" => method_spec(60, 10)
    "basic.qos-ok" => method_spec(60, 11)
    "basic.consume" => method_spec(60, 20)
    "basic.consume-ok" => method_spec(60, 21)
    "basic.cancel" => method_spec(60, 30)
    "basic.cancel-ok" => method_spec(60, 31)
    "basic.publish" => method_spec(60, 40)
    "basic.return" => method_spec(60, 50)
    "basic.deliver" => method_spec(60, 60)
    "basic.get" => method_spec(60, 70)
    "basic.get-ok" => method_spec(60, 71)
    "basic.get-empty" => method_spec(60, 72)
    "basic.ack" => method_spec(60, 80)
    "basic.reject" => method_spec(60, 90)
    "basic.recover-async" => method_spec(60, 100)
    "basic.recover" => method_spec(60, 110)
    "basic.recover-ok" => method_spec(60, 111)
    "basic.nack" => method_spec(60, 120)
    "tx.select" => method_spec(90, 10)
    "tx.select-ok" => method_spec(90, 11)
    "tx.commit" => method_spec(90, 20)
    "tx.commit-ok" => method_spec(90, 21)
    "tx.rollback" => method_spec(90, 30)
    "tx.rollback-ok" => method_spec(90, 31)
    "confirm.select" => method_spec(85, 10)
    "confirm.select-ok" => method_spec(85, 11)
    _ => None
  }
}

///|
pub fn method_names() -> Array[String] {
  [
    "connection.start", "connection.start-ok", "connection.secure", "connection.secure-ok",
    "connection.tune", "connection.tune-ok", "connection.open", "connection.open-ok",
    "connection.close", "connection.close-ok", "connection.blocked", "connection.unblocked",
    "connection.update-secret", "connection.update-secret-ok", "channel.open", "channel.open-ok",
    "channel.flow", "channel.flow-ok", "channel.close", "channel.close-ok", "exchange.declare",
    "exchange.declare-ok", "exchange.delete", "exchange.delete-ok", "exchange.bind",
    "exchange.bind-ok", "exchange.unbind", "exchange.unbind-ok", "queue.declare",
    "queue.declare-ok", "queue.bind", "queue.bind-ok", "queue.unbind", "queue.unbind-ok",
    "queue.purge", "queue.purge-ok", "queue.delete", "queue.delete-ok", "basic.qos",
    "basic.qos-ok", "basic.consume", "basic.consume-ok", "basic.cancel", "basic.cancel-ok",
    "basic.publish", "basic.return", "basic.deliver", "basic.get", "basic.get-ok",
    "basic.get-empty", "basic.ack", "basic.reject", "basic.recover-async", "basic.recover",
    "basic.recover-ok", "basic.nack", "tx.select", "tx.select-ok", "tx.commit", "tx.commit-ok",
    "tx.rollback", "tx.rollback-ok", "confirm.select", "confirm.select-ok",
  ]
}