from ...tl.mtproto_request import MTProtoRequest


class DocumentAttributeImageSize(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute"""

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

    def __init__(self, w, h):
        """
        :param w: Telegram type: «int».
        :param h: Telegram type: «int».

        Constructor for DocumentAttribute: Instance of either DocumentAttributeImageSize, DocumentAttributeAnimated, DocumentAttributeSticker, DocumentAttributeVideo, DocumentAttributeAudio, DocumentAttributeFilename, DocumentAttributeHasStickers.
        """
        super().__init__()

        self.w = w
        self.h = h

    def on_send(self, writer):
        writer.write_int(DocumentAttributeImageSize.constructor_id, signed=False)
        writer.write_int(self.w)
        writer.write_int(self.h)

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

    def on_response(self, reader):
        self.w = reader.read_int()
        self.h = reader.read_int()

    def __repr__(self):
        return 'documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute'

    def __str__(self):
        return '(documentAttributeImageSize (ID: 0x6c37c15c) = (w={}, h={}))'.format(str(self.w), str(self.h))
