from ...tl.tlobject import TLObject


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

    # Telegram's constructor (U)ID for this class
    constructor_id = 0x8e1a1775
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0x3877045f

    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".

        Constructor for NearestDc: Instance of NearestDc.
        """
        super().__init__()

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

    def to_dict(self):
        return {
            'country': self.country,
            'this_dc': self.this_dc,
            'nearest_dc': self.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 (attributes=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 TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
