from ....tl.mtproto_request import MTProtoRequest


class ReportSpamRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool"""

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

    def __init__(self, channel, user_id, id):
        """
        :param channel: Telegram type: "InputChannel".
        :param user_id: Telegram type: "InputUser".
        :param id: Telegram type: "int". Must be a list.

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.channel = channel
        self.user_id = user_id
        self.id = id

    def to_dict(self):
        return {
            'channel': None if self.channel is None else self.channel.to_dict(),
            'user_id': None if self.user_id is None else self.user_id.to_dict(),
            'id': [] if self.id is None else self.id[:],
        }

    def on_send(self, writer):
        writer.write_int(ReportSpamRequest.constructor_id, signed=False)
        self.channel.on_send(writer)
        self.user_id.on_send(writer)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.id))
        for id_item in self.id:
            writer.write_int(id_item)

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

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

    def __repr__(self):
        return 'channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool'

    def __str__(self):
        return '(channels.reportSpam (ID: 0xfe087810) = (channel={}, user_id={}, id={}))'.format(str(self.channel), str(self.user_id), None if not self.id else [str(_) for _ in self.id])
