from ...tl.tlobject import TLObject


class FileLocation(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation"""

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

    def __init__(self, dc_id, volume_id, local_id, secret):
        """
        :param dc_id: Telegram type: "int".
        :param volume_id: Telegram type: "long".
        :param local_id: Telegram type: "int".
        :param secret: Telegram type: "long".

        Constructor for FileLocation: Instance of either FileLocationUnavailable, FileLocation.
        """
        super().__init__()

        self.dc_id = dc_id
        self.volume_id = volume_id
        self.local_id = local_id
        self.secret = secret

    def to_dict(self):
        return {
            'dc_id': self.dc_id,
            'volume_id': self.volume_id,
            'local_id': self.local_id,
            'secret': self.secret,
        }

    def on_send(self, writer):
        writer.write_int(FileLocation.constructor_id, signed=False)
        writer.write_int(self.dc_id)
        writer.write_long(self.volume_id)
        writer.write_int(self.local_id)
        writer.write_long(self.secret)

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

    def on_response(self, reader):
        self.dc_id = reader.read_int()
        self.volume_id = reader.read_long()
        self.local_id = reader.read_int()
        self.secret = reader.read_long()

    def __repr__(self):
        return 'fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation'

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

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