from ...tl.mtproto_request import MTProtoRequest


class InputWebFileLocation(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation"""

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

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

        Constructor for InputWebFileLocation: Instance of InputWebFileLocation.
        """
        super().__init__()

        self.url = url
        self.access_hash = access_hash

    def on_send(self, writer):
        writer.write_int(InputWebFileLocation.constructor_id, signed=False)
        writer.tgwrite_string(self.url)
        writer.write_long(self.access_hash)

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

    def on_response(self, reader):
        self.url = reader.tgread_string()
        self.access_hash = reader.read_long()

    def __repr__(self):
        return 'inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation'

    def __str__(self):
        return '(inputWebFileLocation (ID: 0xc239d686) = (url={}, access_hash={}))'.format(str(self.url), str(self.access_hash))
