// StopReplicaRequest is an advanced request that brokers use to stop replicas.
//
// As this is an advanced request and there is little reason to issue it as a
// client, this request is undocumented.
//
// Kafka 2.2 introduced version 1, proposed in KIP-380, which changed the
// layout of the struct to be more memory efficient.
//
// Kafka 2.6 introduced version 3, proposed in KIP-570, reorganizes partitions
// to be stored and adds the leader epoch and delete partition fields per partition.
// Kafka 3.4 introduced version 4 with KIP-866.
StopReplicaRequest => key 5, max version 4, flexible v2+
  ControllerID: int32
  ControllerEpoch: int32
  // If KRaft controller id is used during migration. See KIP-866.
  IsKRaftController: bool // v4+
  BrokerEpoch: int64(-1) // v1+
  DeletePartitions: bool // v0-v2
  Topics: [=>]
    Topic: string
    Partition: int32 // v0-v0
    Partitions: [int32] // v1-v2
    PartitionStates: [=>] // v3+
      Partition: int32
      LeaderEpoch: int32(-1)
      Delete: bool

// StopReplicasResponse is returned from a StopReplicasRequest.
StopReplicaResponse =>
  // Version 3 returns FENCED_LEADER_EPOCH if the leader is stale (KIP-570).
  ErrorCode: int16
  Partitions: [=>]
    Topic: string
    Partition: int32
    ErrorCode: int16
