// ShareAcknowledgeRequest is a request to acknowledge records in share groups.
//
// Version 0 was used for early access of KIP-932 in Apache Kafka 4.0 but
// removed in Apacke Kafka 4.1.
//
// Version 1 is the initial stable version (KIP-932).
//
// Version 2, introduced in Kafka 4.2, adds IsRenewAck (KIP-1222) and
// AcquisitionLockTimeoutMillis in the response.
ShareAcknowledgeRequest => key 79, max version 2, flexible v0+
  // GroupID is the group identifier.
  GroupID: nullable-string
  // MemberID is the member ID.
  MemberID: nullable-string
  // ShareSessionEpoch is the current share session epoch: 0 to open a share
  // session; -1 to close it; otherwise increments for consecutive requests.
  ShareSessionEpoch: int32
  // IsRenewAck indicates whether Renew type acknowledgements are present
  // in AcknowledgementBatches.
  IsRenewAck: bool // v2+
  // Topics are the topics containing records to acknowledge.
  Topics: [=>]
    // TopicID is the unique topic ID.
    TopicID: uuid
    // Partitions are the partitions containing records to acknowledge.
    Partitions: [=>]
      // Partition is the partition index.
      Partition: int32
      // AcknowledgementBatches are record batches to acknowledge.
      AcknowledgementBatches: [=>]
        // FirstOffset is the first offset of batch of records to acknowledge.
        FirstOffset: int64
        // LastOffset is the last offset (inclusive) of batch of records to
        // acknowledge.
        LastOffset: int64
        // AcknowledgeTypes is an array of acknowledge types -
        // 0:Gap,1:Accept,2:Release,3:Reject.
        AcknowledgeTypes: [int8]

// ShareAcknowledgeResponse is a response for a ShareAcknowledgeRequest.
ShareAcknowledgeResponse =>
  ThrottleMillis
  // ErrorCode is the top level response error code.
  //
  // Supported errors:
  // - GROUP_AUTHORIZATION_FAILED (version 0+)
  // - TOPIC_AUTHORIZATION_FAILED (version 0+)
  // - UNKNOWN_TOPIC_OR_PARTITION (version 0+)
  // - SHARE_SESSION_NOT_FOUND (version 0+)
  // - INVALID_SHARE_SESSION_EPOCH (version 0+)
  // - NOT_LEADER_OR_FOLLOWER (version 0+)
  // - UNKNOWN_TOPIC_ID (version 0+)
  // - INVALID_RECORD_STATE (version 0+)
  // - KAFKA_STORAGE_ERROR (version 0+)
  // - INVALID_REQUEST (version 0+)
  // - UNKNOWN_SERVER_ERROR (version 0+)
  ErrorCode: int16
  // ErrorMessage is the top-level error message, or null if there was no
  // error.
  ErrorMessage: nullable-string
  // AcquisitionLockTimeoutMillis is the time in milliseconds for which the
  // acquired records are locked.
  AcquisitionLockTimeoutMillis: int32 // v2+
  // Topics are the response topics.
  Topics: [=>]
    // TopicID is the unique topic ID.
    TopicID: uuid
    // Partitions are the topic partitions.
    Partitions: [=>]
      // Partition is the partition index.
      Partition: int32
      // ErrorCode is the error code, or 0 if there was no error.
      ErrorCode: int16
      // ErrorMessage is the error message, or null if there was no error.
      ErrorMessage: nullable-string
      // CurrentLeader is the current leader of the partition.
      CurrentLeader: =>
        // LeaderID is the ID of the current leader or -1 if the leader is
        // unknown.
        LeaderID: int32
        // LeaderEpoch is the latest known leader epoch.
        LeaderEpoch: int32
  // NodeEndpoints are endpoints for all current leaders enumerated in
  // PartitionData with error NOT_LEADER_OR_FOLLOWER.
  NodeEndpoints: [=>]
    // NodeID is the ID of the associated node.
    NodeID: int32
    // Host is the node's hostname.
    Host: string
    // Port is the node's port.
    Port: int32
    // Rack is the rack of the node, or null if it has not been assigned to a
    // rack.
    Rack: nullable-string

