"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from ...utils import get_input_peer, get_input_channel, get_input_user, get_input_media
import os
import struct


class GetChannelDifferenceRequest(TLObject):
    CONSTRUCTOR_ID = 0x3173d78
    SUBCLASS_OF_ID = 0x29896f5d

    def __init__(self, channel, filter, pts, limit, force=None):
        """
        :param bool | None force:
        :param TLObject channel:
        :param TLObject filter:
        :param int pts:
        :param int limit:

        :returns updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.force = force
        self.channel = get_input_channel(channel)
        self.filter = filter
        self.pts = pts
        self.limit = limit

    def to_dict(self, recursive=True):
        return {
            'force': self.force,
            'channel': (None if self.channel is None else self.channel.to_dict()) if recursive else self.channel,
            'filter': (None if self.filter is None else self.filter.to_dict()) if recursive else self.filter,
            'pts': self.pts,
            'limit': self.limit,
        }

    def to_bytes(self):
        return b''.join((
            b'x=\x17\x03',
            struct.pack('<I', (1 if self.force else 0)),
            self.channel.to_bytes(),
            self.filter.to_bytes(),
            struct.pack('<i', self.pts),
            struct.pack('<i', self.limit),
        ))

    @staticmethod
    def empty():
        return GetChannelDifferenceRequest(None, None, None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

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

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


class GetDifferenceRequest(TLObject):
    CONSTRUCTOR_ID = 0x25939651
    SUBCLASS_OF_ID = 0x20482874

    def __init__(self, pts, date, qts, pts_total_limit=None):
        """
        :param int pts:
        :param int | None pts_total_limit:
        :param datetime.datetime | None date:
        :param int qts:

        :returns updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.pts = pts
        self.pts_total_limit = pts_total_limit
        self.date = date
        self.qts = qts

    def to_dict(self, recursive=True):
        return {
            'pts': self.pts,
            'pts_total_limit': self.pts_total_limit,
            'date': self.date,
            'qts': self.qts,
        }

    def to_bytes(self):
        return b''.join((
            b'Q\x96\x93%',
            struct.pack('<I', (1 if self.pts_total_limit else 0)),
            struct.pack('<i', self.pts),
            b'' if not self.pts_total_limit else (struct.pack('<i', self.pts_total_limit)),
            b'\0\0\0\0' if self.date is None else struct.pack('<I', int(self.date.timestamp())),
            struct.pack('<i', self.qts),
        ))

    @staticmethod
    def empty():
        return GetDifferenceRequest(None, None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

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

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


class GetStateRequest(TLObject):
    CONSTRUCTOR_ID = 0xedd4882a
    SUBCLASS_OF_ID = 0x23df1a01

    def __init__(self):
        super().__init__()
        self.result = None
        self.content_related = True

    def to_dict(self, recursive=True):
        return {}

    def to_bytes(self):
        return b''.join((
            b'*\x88\xd4\xed',
        ))

    @staticmethod
    def empty():
        return GetStateRequest()

    def on_response(self, reader):
        self.result = reader.tgread_object()

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

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