from __future__ import absolute_import

from .struct import Struct
from .types import Array, Bytes, Int16, Schema, String


class ApiVersionResponse_v0(Struct):
    API_KEY = 18
    API_VERSION = 0
    SCHEMA = Schema(
        ('error_code', Int16),
        ('api_versions', Array(
            ('api_key', Int16),
            ('min_version', Int16),
            ('max_version', Int16))))


class ApiVersionRequest_v0(Struct):
    API_KEY = 18
    API_VERSION = 0
    RESPONSE_TYPE = ApiVersionResponse_v0
    SCHEMA = Schema()


ApiVersionRequest = [ApiVersionRequest_v0]
ApiVersionResponse = [ApiVersionResponse_v0]


class ListGroupsResponse_v0(Struct):
    API_KEY = 16
    API_VERSION = 0
    SCHEMA = Schema(
        ('error_code', Int16),
        ('groups', Array(
            ('group', String('utf-8')),
            ('protocol_type', String('utf-8'))))
    )


class ListGroupsRequest_v0(Struct):
    API_KEY = 16
    API_VERSION = 0
    RESPONSE_TYPE = ListGroupsResponse_v0
    SCHEMA = Schema()


ListGroupsRequest = [ListGroupsRequest_v0]
ListGroupsResponse = [ListGroupsResponse_v0]


class DescribeGroupsResponse_v0(Struct):
    API_KEY = 15
    API_VERSION = 0
    SCHEMA = Schema(
        ('groups', Array(
            ('error_code', Int16),
            ('group', String('utf-8')),
            ('state', String('utf-8')),
            ('protocol_type', String('utf-8')),
            ('protocol', String('utf-8')),
            ('members', Array(
                ('member_id', String('utf-8')),
                ('client_id', String('utf-8')),
                ('client_host', String('utf-8')),
                ('member_metadata', Bytes),
                ('member_assignment', Bytes)))))
    )


class DescribeGroupsRequest_v0(Struct):
    API_KEY = 15
    API_VERSION = 0
    RESPONSE_TYPE = DescribeGroupsResponse_v0
    SCHEMA = Schema(
        ('groups', Array(String('utf-8')))
    )


DescribeGroupsRequest = [DescribeGroupsRequest_v0]
DescribeGroupsResponse = [DescribeGroupsResponse_v0]


class SaslHandShakeResponse_v0(Struct):
    API_KEY = 17
    API_VERSION = 0
    SCHEMA = Schema(
        ('error_code', Int16),
        ('enabled_mechanisms', Array(String('utf-8')))
    )


class SaslHandShakeRequest_v0(Struct):
    API_KEY = 17
    API_VERSION = 0
    RESPONSE_TYPE = SaslHandShakeResponse_v0
    SCHEMA = Schema(
        ('mechanism', String('utf-8'))
    )

SaslHandShakeRequest = [SaslHandShakeRequest_v0]
SaslHandShakeResponse = [SaslHandShakeResponse_v0]

@@ -99,16 +99,23 @@
 , Int16,
+ Int32,
  Schema,
@@ -122,16 +122,16 @@
  String%0A
-
 %0A%0Aclass 
@@ -386,16 +386,21 @@
 Int16)))
+%0A    
 )%0A%0A%0Aclas
@@ -577,16 +577,16 @@
 est_v0%5D%0A
-
 ApiVersi
@@ -620,24 +620,1477 @@
 ponse_v0%5D%0A%0A%0A
+class CreateTopicsResponse_v0(Struct):%0A    API_KEY = 19%0A    API_VERSION = 0%0A    SCHEMA = Schema(%0A        ('topic_error_codes', Array(%0A            ('topic', String('utf-8')),%0A            ('error_code', Int16)))%0A    )%0A%0A%0Aclass CreateTopicsRequest_v0(Struct):%0A    API_KEY = 19%0A    API_VERSION = 0%0A    RESPONSE_TYPE = CreateTopicsResponse_v0%0A    SCHEMA = Schema(%0A        ('create_topic_requests', Array(%0A            ('topic', String('utf-8')),%0A            ('num_partitions', Int32),%0A            ('replication_factor', Int16),%0A            ('replica_assignment', Array(%0A                ('partition_id', Int32),%0A                ('replicas', Array(Int32)))),%0A            ('configs', Array(%0A                ('config_key', String('utf-8')),%0A                ('config_value', String('utf-8')))))),%0A        ('timeout', Int32)%0A    )%0A%0A%0ACreateTopicsRequest = %5BCreateTopicsRequest_v0%5D%0ACreateTopicsResponse = %5BCreateTopicsResponse_v0%5D%0A%0A%0Aclass DeleteTopicsResponse_v0(Struct):%0A    API_KEY = 20%0A    API_VERSION = 0%0A    SCHEMA = Schema(%0A        ('topic_error_codes', Array(%0A            ('topic', String('utf-8')),%0A            ('error_code', Int16)))%0A    )%0A%0A%0Aclass DeleteTopicsRequest_v0(Struct):%0A    API_KEY = 20%0A    API_VERSION = 0%0A    RESPONSE_TYPE = DeleteTopicsResponse_v0%0A    SCHEMA = Schema(%0A        ('topics', Array(String('utf-8'))),%0A        ('timeout', Int32)%0A    )%0A%0A%0ADeleteTopicsRequest = %5BDeleteTopicsRequest_v0%5D%0ADeleteTopicsResponse = %5BDeleteTopicsResponse_v0%5D%0A%0A%0A
 class ListGr

Add CreateTopics / DeleteTopics Structs (#944)