from ...tl.mtproto_request import MTProtoRequest


class InputPeerChannel(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer"""

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

    def __init__(self, channel_id, access_hash):
        """
        :param channel_id: Telegram type: «int».
        :param access_hash: Telegram type: «long».

        Constructor for InputPeer: Instance of either InputPeerEmpty, InputPeerSelf, InputPeerChat, InputPeerUser, InputPeerChannel.
        """
        super().__init__()

        self.channel_id = channel_id
        self.access_hash = access_hash

    def on_send(self, writer):
        writer.write_int(InputPeerChannel.constructor_id, signed=False)
        writer.write_int(self.channel_id)
        writer.write_long(self.access_hash)

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

    def on_response(self, reader):
        self.channel_id = reader.read_int()
        self.access_hash = reader.read_long()

    def __repr__(self):
        return 'inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer'

    def __str__(self):
        return '(inputPeerChannel (ID: 0x20adaef8) = (channel_id={}, access_hash={}))'.format(str(self.channel_id), str(self.access_hash))
