{{ self::swift_doc_block(doc, "") }}public enum {{ class_name }}: Int32, Hashable, Sendable, CaseIterable{% if is_error %}, Error{% endif %} {
{%- for variant in variants %}
{{ self::swift_doc_block(variant.doc, "    ") }}    case {{ variant.swift_name }} = {{ variant.discriminant }}
{%- endfor %}

    @usableFromInline init(fromC c: Int32) { self = {{ class_name }}(rawValue: c)! }
    @usableFromInline var cValue: Int32 { rawValue }

}

extension {{ class_name }}: WireCodable {
    @inlinable static func decode(from reader: inout WireReader) -> {{ class_name }} { {{ class_name }}(rawValue: reader.readI32())! }
    @inlinable func encode(to writer: inout WireWriter) { writer.writeI32(rawValue) }
}
