from telethon.tl.mtproto_request import MTProtoRequest


class NearestDc(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc"""

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

    def __init__(self, country, this_dc, nearest_dc):
        """
        :param country: Telegram type: «string».
        :param this_dc: Telegram type: «int».
        :param nearest_dc: Telegram type: «int».
        """
        super().__init__()

        self.country = country
        self.this_dc = this_dc
        self.nearest_dc = nearest_dc

    def on_send(self, writer):
        writer.write_int(NearestDc.constructor_id, signed=False)
        writer.tgwrite_string(self.country)
        writer.write_int(self.this_dc)
        writer.write_int(self.nearest_dc)

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

    def on_response(self, reader):
        self.country = reader.tgread_string()
        self.this_dc = reader.read_int()
        self.nearest_dc = reader.read_int()

    def __repr__(self):
        return 'nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc'

    def __str__(self):
        return '(nearestDc (ID: 0x8e1a1775) = (country={}, this_dc={}, nearest_dc={}))'.format(str(self.country), str(self.this_dc), str(self.nearest_dc))
