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

// LangpackGetDifferenceRequest represents TL type `langpack.getDifference#cd984aa5`.
// Get new strings in language pack
//
// See https://core.telegram.org/method/langpack.getDifference for reference.
type LangpackGetDifferenceRequest struct {
	// Language pack
	LangPack string
	// Language code
	LangCode string
	// Previous localization pack version
	FromVersion int
}

// LangpackGetDifferenceRequestTypeID is TL type id of LangpackGetDifferenceRequest.
const LangpackGetDifferenceRequestTypeID = 0xcd984aa5

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *LangpackGetDifferenceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langpack.getDifference#cd984aa5 as nil")
	}
	.PutID(LangpackGetDifferenceRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangpackGetDifferenceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langpack.getDifference#cd984aa5 as nil")
	}
	.PutString(.LangPack)
	.PutString(.LangCode)
	.PutInt(.FromVersion)
	return nil
}

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

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

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

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

// GetFromVersion returns value of FromVersion field.
func ( *LangpackGetDifferenceRequest) () ( int) {
	if  == nil {
		return
	}
	return .FromVersion
}

// LangpackGetDifference invokes method langpack.getDifference#cd984aa5 returning error if any.
// Get new strings in language pack
//
// Possible errors:
//
//	400 LANG_PACK_INVALID: The provided language pack is invalid.
//
// See https://core.telegram.org/method/langpack.getDifference for reference.
func ( *Client) ( context.Context,  *LangpackGetDifferenceRequest) (*LangPackDifference, error) {
	var  LangPackDifference

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