from ....tl.mtproto_request import MTProtoRequest


class SentCodeTypeFlashCall(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType"""

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

    def __init__(self, pattern):
        """
        :param pattern: Telegram type: «string».

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

        self.pattern = pattern

    def on_send(self, writer):
        writer.write_int(SentCodeTypeFlashCall.constructor_id, signed=False)
        writer.tgwrite_string(self.pattern)

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

    def on_response(self, reader):
        self.pattern = reader.tgread_string()

    def __repr__(self):
        return 'auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType'

    def __str__(self):
        return '(auth.sentCodeTypeFlashCall (ID: 0xab03c6d9) = (pattern={}))'.format(str(self.pattern))
