from telethon.tl.mtproto_request import MTProtoRequest


class SaveDeveloperInfoRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool"""

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

    def __init__(self, vk_id, name, phone_number, age, city):
        """
        :param vk_id: Telegram type: «int».
        :param name: Telegram type: «string».
        :param phone_number: Telegram type: «string».
        :param age: Telegram type: «int».
        :param city: Telegram type: «string».
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.vk_id = vk_id
        self.name = name
        self.phone_number = phone_number
        self.age = age
        self.city = city

    def on_send(self, writer):
        writer.write_int(SaveDeveloperInfoRequest.constructor_id, signed=False)
        writer.write_int(self.vk_id)
        writer.tgwrite_string(self.name)
        writer.tgwrite_string(self.phone_number)
        writer.write_int(self.age)
        writer.tgwrite_string(self.city)

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

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

    def __repr__(self):
        return 'contest.saveDeveloperInfo#9a5f6e95 vk_id:int name:string phone_number:string age:int city:string = Bool'

    def __str__(self):
        return '(contest.saveDeveloperInfo (ID: 0x9a5f6e95) = (vk_id={}, name={}, phone_number={}, age={}, city={}))'.format(str(self.vk_id), str(self.name), str(self.phone_number), str(self.age), str(self.city))
