"""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 ClearSavedInfoRequest(TLObject):
    CONSTRUCTOR_ID = 0xd83d70c1
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, credentials=None, info=None):
        """
        :param bool | None credentials:
        :param bool | None info:

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.credentials = credentials
        self.info = info

    def to_dict(self, recursive=True):
        return {
            'credentials': self.credentials,
            'info': self.info,
        }

    def to_bytes(self):
        return b''.join((
            b'\xc1p=\xd8',
            struct.pack('<I', (1 if self.credentials else 0) | (2 if self.info else 0)),
        ))

    @staticmethod
    def empty():
        return ClearSavedInfoRequest(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 GetPaymentFormRequest(TLObject):
    CONSTRUCTOR_ID = 0x99f09745
    SUBCLASS_OF_ID = 0xa0483f19

    def __init__(self, msg_id):
        """
        :param int msg_id:

        :returns payments.PaymentForm: Instance of PaymentForm.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.msg_id = msg_id

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

    def to_bytes(self):
        return b''.join((
            b'E\x97\xf0\x99',
            struct.pack('<i', self.msg_id),
        ))

    @staticmethod
    def empty():
        return GetPaymentFormRequest(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 GetPaymentReceiptRequest(TLObject):
    CONSTRUCTOR_ID = 0xa092a980
    SUBCLASS_OF_ID = 0x590093c9

    def __init__(self, msg_id):
        """
        :param int msg_id:

        :returns payments.PaymentReceipt: Instance of PaymentReceipt.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.msg_id = msg_id

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

    def to_bytes(self):
        return b''.join((
            b'\x80\xa9\x92\xa0',
            struct.pack('<i', self.msg_id),
        ))

    @staticmethod
    def empty():
        return GetPaymentReceiptRequest(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 GetSavedInfoRequest(TLObject):
    CONSTRUCTOR_ID = 0x227d824b
    SUBCLASS_OF_ID = 0xad3cf146

    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'K\x82}"',
        ))

    @staticmethod
    def empty():
        return GetSavedInfoRequest()

    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 SendPaymentFormRequest(TLObject):
    CONSTRUCTOR_ID = 0x2b8879b3
    SUBCLASS_OF_ID = 0x8ae16a9d

    def __init__(self, msg_id, credentials, requested_info_id=None, shipping_option_id=None):
        """
        :param int msg_id:
        :param str | None requested_info_id:
        :param str | None shipping_option_id:
        :param TLObject credentials:

        :returns payments.PaymentResult: Instance of either PaymentResult, PaymentVerficationNeeded.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.msg_id = msg_id
        self.requested_info_id = requested_info_id
        self.shipping_option_id = shipping_option_id
        self.credentials = credentials

    def to_dict(self, recursive=True):
        return {
            'msg_id': self.msg_id,
            'requested_info_id': self.requested_info_id,
            'shipping_option_id': self.shipping_option_id,
            'credentials': (None if self.credentials is None else self.credentials.to_dict()) if recursive else self.credentials,
        }

    def to_bytes(self):
        return b''.join((
            b'\xb3y\x88+',
            struct.pack('<I', (1 if self.requested_info_id else 0) | (2 if self.shipping_option_id else 0)),
            struct.pack('<i', self.msg_id),
            b'' if not self.requested_info_id else (TLObject.serialize_bytes(self.requested_info_id)),
            b'' if not self.shipping_option_id else (TLObject.serialize_bytes(self.shipping_option_id)),
            self.credentials.to_bytes(),
        ))

    @staticmethod
    def empty():
        return SendPaymentFormRequest(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 ValidateRequestedInfoRequest(TLObject):
    CONSTRUCTOR_ID = 0x770a8e74
    SUBCLASS_OF_ID = 0x8f8044b7

    def __init__(self, msg_id, info, save=None):
        """
        :param bool | None save:
        :param int msg_id:
        :param TLObject info:

        :returns payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.save = save
        self.msg_id = msg_id
        self.info = info

    def to_dict(self, recursive=True):
        return {
            'save': self.save,
            'msg_id': self.msg_id,
            'info': (None if self.info is None else self.info.to_dict()) if recursive else self.info,
        }

    def to_bytes(self):
        return b''.join((
            b't\x8e\nw',
            struct.pack('<I', (1 if self.save else 0)),
            struct.pack('<i', self.msg_id),
            self.info.to_bytes(),
        ))

    @staticmethod
    def empty():
        return ValidateRequestedInfoRequest(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)
