from telethon.tl.mtproto_request import MTProtoRequest


class PhoneCallRequested(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    phoneCallRequested#6c448ae8 id:long access_hash:long date:date admin_id:int participant_id:int g_a:bytes protocol:PhoneCallProtocol = PhoneCall"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0x6c448ae8

    def __init__(self, id, access_hash, date, admin_id, participant_id, g_a, protocol):
        """
        :param id: Telegram type: «long».
        :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».
        :param protocol: Telegram type: «PhoneCallProtocol».
        """
        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
        self.protocol = protocol

    def on_send(self, writer):
        writer.write_int(PhoneCallRequested.constructor_id, signed=False)
        writer.write_long(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)
        self.protocol.on_send(writer)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return PhoneCallRequested(None, None, None, None, None, None, None)

    def on_response(self, reader):
        self.id = reader.read_long()
        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()
        self.protocol = reader.tgread_object()

    def __repr__(self):
        return 'phoneCallRequested#6c448ae8 id:long access_hash:long date:date admin_id:int participant_id:int g_a:bytes protocol:PhoneCallProtocol = PhoneCall'

    def __str__(self):
        return '(phoneCallRequested (ID: 0x6c448ae8) = (id={}, access_hash={}, date={}, admin_id={}, participant_id={}, g_a={}, protocol={}))'.format(str(self.id), str(self.access_hash), str(self.date), str(self.admin_id), str(self.participant_id), str(self.g_a), str(self.protocol))
