# AUTOGENERATED
from typing import NamedTuple, List, Optional, Iterable
from enum import Enum

from protobuf_gen.abstract import Message
from etcd3wrapper._autogen.etcd.auth.authpb import auth_pb2


# Messages


class User(Message):
    pb_cls = auth_pb2.User

    __slots__ = ['name', 'password', 'roles']

    def __init__(
        self,
        name: bytes = b'',
        password: bytes = b'',
        roles: List[str] = None
    ):
        self.name = name
        self.password = password
        self.roles = [] if roles is None else roles

    @classmethod
    def get_slot_types(cls):
        return [bytes, bytes, List[str]]


class Permission(Message):
    pb_cls = auth_pb2.Permission

    __slots__ = ['permType', 'key', 'range_end']

    class Type(Enum):
        READ = 0
        WRITE = 1
        READWRITE = 2

    def __init__(
        self,
        permType: 'Type' = Type.READ,
        key: bytes = b'',
        range_end: bytes = b''
    ):
        self.permType = permType
        self.key = key
        self.range_end = range_end

    @classmethod
    def get_slot_types(cls):
        return [cls.Type, bytes, bytes]


class Role(Message):
    pb_cls = auth_pb2.Role

    __slots__ = ['name', 'keyPermission']

    def __init__(
        self,
        name: bytes = b'',
        keyPermission: List['Permission'] = None
    ):
        self.name = name
        self.keyPermission = [] if keyPermission is None else keyPermission

    @classmethod
    def get_slot_types(cls):
        return [bytes, List[Permission]]

# AUTOGENERATED
from typing import NamedTuple, List, Optional, Iterable
from enum import Enum

from protobuf_gen.abstract import Message
from etcd3wrapper._autogen.etcd.auth.authpb import auth_pb2


# Messages


class User(Message):
    pb_cls = auth_pb2.User

    __slots__ = ['name', 'password', 'roles']

    def __init__(
        self,
        name: bytes = b'',
        password: bytes = b'',
        roles: List[str] = None
    ):
        self.name = name
        self.password = password
        self.roles = [] if roles is None else roles

    @classmethod
    def get_slot_types(cls):
        return [bytes, bytes, List[str]]


class Permission(Message):
    pb_cls = auth_pb2.Permission

    __slots__ = ['permType', 'key', 'range_end']

    class Type(Enum):
        READ = 0
        WRITE = 1
        READWRITE = 2

    def __init__(
        self,
        permType: 'Type' = Type.READ,
        key: bytes = b'',
        range_end: bytes = b''
    ):
        self.permType = permType
        self.key = key
        self.range_end = range_end

    @classmethod
    def get_slot_types(cls):
        return [cls.Type, bytes, bytes]


class Role(Message):
    pb_cls = auth_pb2.Role

    __slots__ = ['name', 'keyPermission']

    def __init__(
        self,
        name: bytes = b'',
        keyPermission: List['Permission'] = None
    ):
        self.name = name
        self.keyPermission = [] if keyPermission is None else keyPermission

    @classmethod
    def get_slot_types(cls):
        return [bytes, List[Permission]]

# AUTOGENERATED # Messages