from ....tl.mtproto_request import MTProtoRequest


class SentCodeTypeSms(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType"""

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

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

        Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall.
        """
        super().__init__()

        self.length = length

    def on_send(self, writer):
        writer.write_int(SentCodeTypeSms.constructor_id, signed=False)
        writer.write_int(self.length)

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

    def on_response(self, reader):
        self.length = reader.read_int()

    def __repr__(self):
        return 'auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType'

    def __str__(self):
        return '(auth.sentCodeTypeSms (ID: 0xc000bba2) = (length={}))'.format(str(self.length))
