// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// LangpackGetLanguageRequest represents TL type `langpack.getLanguage#6a596502`.
// Get information about a language in a localization pack
//
// See https://core.telegram.org/method/langpack.getLanguage for reference.
type LangpackGetLanguageRequest struct {
	// Language pack name, usually obtained from a language pack linkĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/links#language-pack-links
	LangPack string
	// Language code
	LangCode string
}

// LangpackGetLanguageRequestTypeID is TL type id of LangpackGetLanguageRequest.
const LangpackGetLanguageRequestTypeID = 0x6a596502

// Ensuring interfaces in compile-time for LangpackGetLanguageRequest.
var (
	_ bin.Encoder     = &LangpackGetLanguageRequest{}
	_ bin.Decoder     = &LangpackGetLanguageRequest{}
	_ bin.BareEncoder = &LangpackGetLanguageRequest{}
	_ bin.BareDecoder = &LangpackGetLanguageRequest{}
)

func ( *LangpackGetLanguageRequest) () bool {
	if  == nil {
		return true
	}
	if !(.LangPack == "") {
		return false
	}
	if !(.LangCode == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *LangpackGetLanguageRequest) () string {
	if  == nil {
		return "LangpackGetLanguageRequest(nil)"
	}
	type  LangpackGetLanguageRequest
	return fmt.Sprintf("LangpackGetLanguageRequest%+v", (*))
}

// FillFrom fills LangpackGetLanguageRequest from given interface.
func ( *LangpackGetLanguageRequest) ( interface {
	() ( string)
	() ( string)
}) {
	.LangPack = .()
	.LangCode = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*LangpackGetLanguageRequest) () uint32 {
	return LangpackGetLanguageRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*LangpackGetLanguageRequest) () string {
	return "langpack.getLanguage"
}

// TypeInfo returns info about TL type.
func ( *LangpackGetLanguageRequest) () tdp.Type {
	 := tdp.Type{
		Name: "langpack.getLanguage",
		ID:   LangpackGetLanguageRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "LangPack",
			SchemaName: "lang_pack",
		},
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *LangpackGetLanguageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langpack.getLanguage#6a596502 as nil")
	}
	.PutID(LangpackGetLanguageRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangpackGetLanguageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langpack.getLanguage#6a596502 as nil")
	}
	.PutString(.LangPack)
	.PutString(.LangCode)
	return nil
}

// Decode implements bin.Decoder.
func ( *LangpackGetLanguageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langpack.getLanguage#6a596502 to nil")
	}
	if  := .ConsumeID(LangpackGetLanguageRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode langpack.getLanguage#6a596502: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *LangpackGetLanguageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langpack.getLanguage#6a596502 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langpack.getLanguage#6a596502: field lang_pack: %w", )
		}
		.LangPack = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langpack.getLanguage#6a596502: field lang_code: %w", )
		}
		.LangCode = 
	}
	return nil
}

// GetLangPack returns value of LangPack field.
func ( *LangpackGetLanguageRequest) () ( string) {
	if  == nil {
		return
	}
	return .LangPack
}

// GetLangCode returns value of LangCode field.
func ( *LangpackGetLanguageRequest) () ( string) {
	if  == nil {
		return
	}
	return .LangCode
}

// LangpackGetLanguage invokes method langpack.getLanguage#6a596502 returning error if any.
// Get information about a language in a localization pack
//
// Possible errors:
//
//	400 LANG_CODE_NOT_SUPPORTED: The specified language code is not supported.
//	400 LANG_PACK_INVALID: The provided language pack is invalid.
//
// See https://core.telegram.org/method/langpack.getLanguage for reference.
func ( *Client) ( context.Context,  *LangpackGetLanguageRequest) (*LangPackLanguage, error) {
	var  LangPackLanguage

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}