from ...tl.mtproto_request import MTProtoRequest


class LangPackLanguage(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage"""

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

    def __init__(self, name, native_name, lang_code):
        """
        :param name: Telegram type: "string".
        :param native_name: Telegram type: "string".
        :param lang_code: Telegram type: "string".

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

        self.name = name
        self.native_name = native_name
        self.lang_code = lang_code

    def to_dict(self):
        return {
            'name': self.name,
            'native_name': self.native_name,
            'lang_code': self.lang_code,
        }

    def on_send(self, writer):
        writer.write_int(LangPackLanguage.constructor_id, signed=False)
        writer.tgwrite_string(self.name)
        writer.tgwrite_string(self.native_name)
        writer.tgwrite_string(self.lang_code)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return LangPackLanguage(None, None, None)

    def on_response(self, reader):
        self.name = reader.tgread_string()
        self.native_name = reader.tgread_string()
        self.lang_code = reader.tgread_string()

    def __repr__(self):
        return 'langPackLanguage#117698f1 name:string native_name:string lang_code:string = LangPackLanguage'

    def __str__(self):
        return '(langPackLanguage (ID: 0x117698f1) = (name={}, native_name={}, lang_code={}))'.format(str(self.name), str(self.native_name), str(self.lang_code))
