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

// LangPackDifference represents TL type `langPackDifference#f385c1f6`.
// Changes to the app's localization pack
//
// See https://core.telegram.org/constructor/langPackDifference for reference.
type LangPackDifference struct {
	// Language code
	LangCode string
	// Previous version number
	FromVersion int
	// New version number
	Version int
	// Localized strings
	Strings []LangPackStringClass
}

// LangPackDifferenceTypeID is TL type id of LangPackDifference.
const LangPackDifferenceTypeID = 0xf385c1f6

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

func ( *LangPackDifference) () bool {
	if  == nil {
		return true
	}
	if !(.LangCode == "") {
		return false
	}
	if !(.FromVersion == 0) {
		return false
	}
	if !(.Version == 0) {
		return false
	}
	if !(.Strings == nil) {
		return false
	}

	return true
}

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

// FillFrom fills LangPackDifference from given interface.
func ( *LangPackDifference) ( interface {
	() ( string)
	() ( int)
	() ( int)
	() ( []LangPackStringClass)
}) {
	.LangCode = .()
	.FromVersion = .()
	.Version = .()
	.Strings = .()
}

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

// TypeName returns name of type in TL schema.
func (*LangPackDifference) () string {
	return "langPackDifference"
}

// TypeInfo returns info about TL type.
func ( *LangPackDifference) () tdp.Type {
	 := tdp.Type{
		Name: "langPackDifference",
		ID:   LangPackDifferenceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
		},
		{
			Name:       "FromVersion",
			SchemaName: "from_version",
		},
		{
			Name:       "Version",
			SchemaName: "version",
		},
		{
			Name:       "Strings",
			SchemaName: "strings",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *LangPackDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackDifference#f385c1f6 as nil")
	}
	.PutID(LangPackDifferenceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangPackDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackDifference#f385c1f6 as nil")
	}
	.PutString(.LangCode)
	.PutInt(.FromVersion)
	.PutInt(.Version)
	.PutVectorHeader(len(.Strings))
	for ,  := range .Strings {
		if  == nil {
			return fmt.Errorf("unable to encode langPackDifference#f385c1f6: field strings element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode langPackDifference#f385c1f6: field strings element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *LangPackDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langPackDifference#f385c1f6 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackDifference#f385c1f6: field lang_code: %w", )
		}
		.LangCode = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode langPackDifference#f385c1f6: field from_version: %w", )
		}
		.FromVersion = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode langPackDifference#f385c1f6: field version: %w", )
		}
		.Version = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode langPackDifference#f385c1f6: field strings: %w", )
		}

		if  > 0 {
			.Strings = make([]LangPackStringClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeLangPackString()
			if  != nil {
				return fmt.Errorf("unable to decode langPackDifference#f385c1f6: field strings: %w", )
			}
			.Strings = append(.Strings, )
		}
	}
	return nil
}

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

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

// GetVersion returns value of Version field.
func ( *LangPackDifference) () ( int) {
	if  == nil {
		return
	}
	return .Version
}

// GetStrings returns value of Strings field.
func ( *LangPackDifference) () ( []LangPackStringClass) {
	if  == nil {
		return
	}
	return .Strings
}

// MapStrings returns field Strings wrapped in LangPackStringClassArray helper.
func ( *LangPackDifference) () ( LangPackStringClassArray) {
	return LangPackStringClassArray(.Strings)
}