// 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{}
)

// LangpackGetLanguagesRequest represents TL type `langpack.getLanguages#42c6978f`.
// Get information about all languages in a localization pack
//
// See https://core.telegram.org/method/langpack.getLanguages for reference.
type LangpackGetLanguagesRequest struct {
	// Language pack
	LangPack string
}

// LangpackGetLanguagesRequestTypeID is TL type id of LangpackGetLanguagesRequest.
const LangpackGetLanguagesRequestTypeID = 0x42c6978f

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *LangpackGetLanguagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langpack.getLanguages#42c6978f as nil")
	}
	.PutID(LangpackGetLanguagesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangpackGetLanguagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langpack.getLanguages#42c6978f as nil")
	}
	.PutString(.LangPack)
	return nil
}

// Decode implements bin.Decoder.
func ( *LangpackGetLanguagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langpack.getLanguages#42c6978f to nil")
	}
	if  := .ConsumeID(LangpackGetLanguagesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode langpack.getLanguages#42c6978f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *LangpackGetLanguagesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langpack.getLanguages#42c6978f to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langpack.getLanguages#42c6978f: field lang_pack: %w", )
		}
		.LangPack = 
	}
	return nil
}

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

// LangpackGetLanguages invokes method langpack.getLanguages#42c6978f returning error if any.
// Get information about all languages in a localization pack
//
// Possible errors:
//
//	400 LANG_PACK_INVALID: The provided language pack is invalid.
//
// See https://core.telegram.org/method/langpack.getLanguages for reference.
func ( *Client) ( context.Context,  string) ([]LangPackLanguage, error) {
	var  LangPackLanguageVector

	 := &LangpackGetLanguagesRequest{
		LangPack: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return []LangPackLanguage(.Elems), nil
}