"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject


class AdminLogResults(TLObject):
    constructor_id = 0xed8af74d
    subclass_of_id = 0x51f076bc

    def __init__(self, events, chats, users):
        """
        :param events: Telegram type: "ChannelAdminLogEvent". Must be a list.
        :param chats: Telegram type: "Chat". Must be a list.
        :param users: Telegram type: "User". Must be a list.

        Constructor for channels.AdminLogResults: Instance of AdminLogResults.
        """
        super().__init__()

        self.events = events
        self.chats = chats
        self.users = users

    def to_dict(self):
        return {
            'events': [] if self.events is None else [None if x is None else x.to_dict() for x in self.events],
            'chats': [] if self.chats is None else [None if x is None else x.to_dict() for x in self.chats],
            'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users],
        }

    def on_send(self, writer):
        writer.write_int(AdminLogResults.constructor_id, signed=False)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.events))
        for _x in self.events:
            _x.on_send(writer)

        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.chats))
        for _x in self.chats:
            _x.on_send(writer)

        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.users))
        for _x in self.users:
            _x.on_send(writer)

    @staticmethod
    def empty():
        return AdminLogResults(None, None, None)

    def on_response(self, reader):
        reader.read_int()
        self.events = []
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.events.append(_x)

        reader.read_int()
        self.chats = []
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.chats.append(_x)

        reader.read_int()
        self.users = []
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.users.append(_x)

    def __repr__(self):
        return 'channels.adminLogResults#ed8af74d events:Vector<ChannelAdminLogEvent> chats:Vector<Chat> users:Vector<User> = channels.AdminLogResults'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class ChannelParticipant(TLObject):
    constructor_id = 0xd0d9b163
    subclass_of_id = 0x6658151a

    def __init__(self, participant, users):
        """
        :param participant: Telegram type: "ChannelParticipant".
        :param users: Telegram type: "User". Must be a list.

        Constructor for channels.ChannelParticipant: Instance of ChannelParticipant.
        """
        super().__init__()

        self.participant = participant
        self.users = users

    def to_dict(self):
        return {
            'participant': None if self.participant is None else self.participant.to_dict(),
            'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users],
        }

    def on_send(self, writer):
        writer.write_int(ChannelParticipant.constructor_id, signed=False)
        self.participant.on_send(writer)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.users))
        for _x in self.users:
            _x.on_send(writer)

    @staticmethod
    def empty():
        return ChannelParticipant(None, None)

    def on_response(self, reader):
        self.participant = reader.tgread_object()
        reader.read_int()
        self.users = []
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.users.append(_x)

    def __repr__(self):
        return 'channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class ChannelParticipants(TLObject):
    constructor_id = 0xf56ee2a8
    subclass_of_id = 0xe60a6e64

    def __init__(self, count, participants, users):
        """
        :param count: Telegram type: "int".
        :param participants: Telegram type: "ChannelParticipant". Must be a list.
        :param users: Telegram type: "User". Must be a list.

        Constructor for channels.ChannelParticipants: Instance of ChannelParticipants.
        """
        super().__init__()

        self.count = count
        self.participants = participants
        self.users = users

    def to_dict(self):
        return {
            'count': self.count,
            'participants': [] if self.participants is None else [None if x is None else x.to_dict() for x in self.participants],
            'users': [] if self.users is None else [None if x is None else x.to_dict() for x in self.users],
        }

    def on_send(self, writer):
        writer.write_int(ChannelParticipants.constructor_id, signed=False)
        writer.write_int(self.count)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.participants))
        for _x in self.participants:
            _x.on_send(writer)

        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.users))
        for _x in self.users:
            _x.on_send(writer)

    @staticmethod
    def empty():
        return ChannelParticipants(None, None, None)

    def on_response(self, reader):
        self.count = reader.read_int()
        reader.read_int()
        self.participants = []
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.participants.append(_x)

        reader.read_int()
        self.users = []
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.users.append(_x)

    def __repr__(self):
        return 'channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)

