from ...tl.tlobject import TLObject


class EncryptedChatRequested(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0xc878527e
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0x6d28a37a

    def __init__(self, id, access_hash, date, admin_id, participant_id, g_a):
        """
        :param id: Telegram type: "int".
        :param access_hash: Telegram type: "long".
        :param date: Telegram type: "date".
        :param admin_id: Telegram type: "int".
        :param participant_id: Telegram type: "int".
        :param g_a: Telegram type: "bytes".

        Constructor for EncryptedChat: Instance of either EncryptedChatEmpty, EncryptedChatWaiting, EncryptedChatRequested, EncryptedChat, EncryptedChatDiscarded.
        """
        super().__init__()

        self.id = id
        self.access_hash = access_hash
        self.date = date
        self.admin_id = admin_id
        self.participant_id = participant_id
        self.g_a = g_a

    def to_dict(self):
        return {
            'id': self.id,
            'access_hash': self.access_hash,
            'date': self.date,
            'admin_id': self.admin_id,
            'participant_id': self.participant_id,
            'g_a': self.g_a,
        }

    def on_send(self, writer):
        writer.write_int(EncryptedChatRequested.constructor_id, signed=False)
        writer.write_int(self.id)
        writer.write_long(self.access_hash)
        writer.tgwrite_date(self.date)
        writer.write_int(self.admin_id)
        writer.write_int(self.participant_id)
        writer.tgwrite_bytes(self.g_a)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return EncryptedChatRequested(None, None, None, None, None, None)

    def on_response(self, reader):
        self.id = reader.read_int()
        self.access_hash = reader.read_long()
        self.date = reader.tgread_date()
        self.admin_id = reader.read_int()
        self.participant_id = reader.read_int()
        self.g_a = reader.tgread_bytes()

    def __repr__(self):
        return 'encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat'

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

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