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

// LangPackString represents TL type `langPackString#cad181f6`.
// Translated localization string
//
// See https://core.telegram.org/constructor/langPackString for reference.
type LangPackString struct {
	// Language key
	Key string
	// Value
	Value string
}

// LangPackStringTypeID is TL type id of LangPackString.
const LangPackStringTypeID = 0xcad181f6

// construct implements constructor of LangPackStringClass.
func ( LangPackString) () LangPackStringClass { return & }

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

	_ LangPackStringClass = &LangPackString{}
)

func ( *LangPackString) () bool {
	if  == nil {
		return true
	}
	if !(.Key == "") {
		return false
	}
	if !(.Value == "") {
		return false
	}

	return true
}

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

// FillFrom fills LangPackString from given interface.
func ( *LangPackString) ( interface {
	() ( string)
	() ( string)
}) {
	.Key = .()
	.Value = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *LangPackString) () tdp.Type {
	 := tdp.Type{
		Name: "langPackString",
		ID:   LangPackStringTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "Value",
			SchemaName: "value",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *LangPackString) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackString#cad181f6 as nil")
	}
	.PutID(LangPackStringTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangPackString) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackString#cad181f6 as nil")
	}
	.PutString(.Key)
	.PutString(.Value)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *LangPackString) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langPackString#cad181f6 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackString#cad181f6: field key: %w", )
		}
		.Key = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackString#cad181f6: field value: %w", )
		}
		.Value = 
	}
	return nil
}

// GetKey returns value of Key field.
func ( *LangPackString) () ( string) {
	if  == nil {
		return
	}
	return .Key
}

// GetValue returns value of Value field.
func ( *LangPackString) () ( string) {
	if  == nil {
		return
	}
	return .Value
}

// LangPackStringPluralized represents TL type `langPackStringPluralized#6c47ac9f`.
// A language pack string which has different forms based on the number of some object it
// mentions. See https://www.unicode
// org/cldr/charts/latest/supplemental/language_plural_rules.html¹ for more info
//
// Links:
//  1. https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
//
// See https://core.telegram.org/constructor/langPackStringPluralized for reference.
type LangPackStringPluralized struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Localization key
	Key string
	// Value for zero objects
	//
	// Use SetZeroValue and GetZeroValue helpers.
	ZeroValue string
	// Value for one object
	//
	// Use SetOneValue and GetOneValue helpers.
	OneValue string
	// Value for two objects
	//
	// Use SetTwoValue and GetTwoValue helpers.
	TwoValue string
	// Value for a few objects
	//
	// Use SetFewValue and GetFewValue helpers.
	FewValue string
	// Value for many objects
	//
	// Use SetManyValue and GetManyValue helpers.
	ManyValue string
	// Default value
	OtherValue string
}

// LangPackStringPluralizedTypeID is TL type id of LangPackStringPluralized.
const LangPackStringPluralizedTypeID = 0x6c47ac9f

// construct implements constructor of LangPackStringClass.
func ( LangPackStringPluralized) () LangPackStringClass { return & }

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

	_ LangPackStringClass = &LangPackStringPluralized{}
)

func ( *LangPackStringPluralized) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Key == "") {
		return false
	}
	if !(.ZeroValue == "") {
		return false
	}
	if !(.OneValue == "") {
		return false
	}
	if !(.TwoValue == "") {
		return false
	}
	if !(.FewValue == "") {
		return false
	}
	if !(.ManyValue == "") {
		return false
	}
	if !(.OtherValue == "") {
		return false
	}

	return true
}

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

// FillFrom fills LangPackStringPluralized from given interface.
func ( *LangPackStringPluralized) ( interface {
	() ( string)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( string)
}) {
	.Key = .()
	if ,  := .();  {
		.ZeroValue = 
	}

	if ,  := .();  {
		.OneValue = 
	}

	if ,  := .();  {
		.TwoValue = 
	}

	if ,  := .();  {
		.FewValue = 
	}

	if ,  := .();  {
		.ManyValue = 
	}

	.OtherValue = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *LangPackStringPluralized) () tdp.Type {
	 := tdp.Type{
		Name: "langPackStringPluralized",
		ID:   LangPackStringPluralizedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Key",
			SchemaName: "key",
		},
		{
			Name:       "ZeroValue",
			SchemaName: "zero_value",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "OneValue",
			SchemaName: "one_value",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "TwoValue",
			SchemaName: "two_value",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "FewValue",
			SchemaName: "few_value",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "ManyValue",
			SchemaName: "many_value",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "OtherValue",
			SchemaName: "other_value",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *LangPackStringPluralized) () {
	if !(.ZeroValue == "") {
		.Flags.Set(0)
	}
	if !(.OneValue == "") {
		.Flags.Set(1)
	}
	if !(.TwoValue == "") {
		.Flags.Set(2)
	}
	if !(.FewValue == "") {
		.Flags.Set(3)
	}
	if !(.ManyValue == "") {
		.Flags.Set(4)
	}
}

// Encode implements bin.Encoder.
func ( *LangPackStringPluralized) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackStringPluralized#6c47ac9f as nil")
	}
	.PutID(LangPackStringPluralizedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangPackStringPluralized) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackStringPluralized#6c47ac9f as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode langPackStringPluralized#6c47ac9f: field flags: %w", )
	}
	.PutString(.Key)
	if .Flags.Has(0) {
		.PutString(.ZeroValue)
	}
	if .Flags.Has(1) {
		.PutString(.OneValue)
	}
	if .Flags.Has(2) {
		.PutString(.TwoValue)
	}
	if .Flags.Has(3) {
		.PutString(.FewValue)
	}
	if .Flags.Has(4) {
		.PutString(.ManyValue)
	}
	.PutString(.OtherValue)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *LangPackStringPluralized) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langPackStringPluralized#6c47ac9f to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field key: %w", )
		}
		.Key = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field zero_value: %w", )
		}
		.ZeroValue = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field one_value: %w", )
		}
		.OneValue = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field two_value: %w", )
		}
		.TwoValue = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field few_value: %w", )
		}
		.FewValue = 
	}
	if .Flags.Has(4) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field many_value: %w", )
		}
		.ManyValue = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringPluralized#6c47ac9f: field other_value: %w", )
		}
		.OtherValue = 
	}
	return nil
}

// GetKey returns value of Key field.
func ( *LangPackStringPluralized) () ( string) {
	if  == nil {
		return
	}
	return .Key
}

// SetZeroValue sets value of ZeroValue conditional field.
func ( *LangPackStringPluralized) ( string) {
	.Flags.Set(0)
	.ZeroValue = 
}

// GetZeroValue returns value of ZeroValue conditional field and
// boolean which is true if field was set.
func ( *LangPackStringPluralized) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .ZeroValue, true
}

// SetOneValue sets value of OneValue conditional field.
func ( *LangPackStringPluralized) ( string) {
	.Flags.Set(1)
	.OneValue = 
}

// GetOneValue returns value of OneValue conditional field and
// boolean which is true if field was set.
func ( *LangPackStringPluralized) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .OneValue, true
}

// SetTwoValue sets value of TwoValue conditional field.
func ( *LangPackStringPluralized) ( string) {
	.Flags.Set(2)
	.TwoValue = 
}

// GetTwoValue returns value of TwoValue conditional field and
// boolean which is true if field was set.
func ( *LangPackStringPluralized) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .TwoValue, true
}

// SetFewValue sets value of FewValue conditional field.
func ( *LangPackStringPluralized) ( string) {
	.Flags.Set(3)
	.FewValue = 
}

// GetFewValue returns value of FewValue conditional field and
// boolean which is true if field was set.
func ( *LangPackStringPluralized) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .FewValue, true
}

// SetManyValue sets value of ManyValue conditional field.
func ( *LangPackStringPluralized) ( string) {
	.Flags.Set(4)
	.ManyValue = 
}

// GetManyValue returns value of ManyValue conditional field and
// boolean which is true if field was set.
func ( *LangPackStringPluralized) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .ManyValue, true
}

// GetOtherValue returns value of OtherValue field.
func ( *LangPackStringPluralized) () ( string) {
	if  == nil {
		return
	}
	return .OtherValue
}

// LangPackStringDeleted represents TL type `langPackStringDeleted#2979eeb2`.
// Deleted localization string
//
// See https://core.telegram.org/constructor/langPackStringDeleted for reference.
type LangPackStringDeleted struct {
	// Localization key
	Key string
}

// LangPackStringDeletedTypeID is TL type id of LangPackStringDeleted.
const LangPackStringDeletedTypeID = 0x2979eeb2

// construct implements constructor of LangPackStringClass.
func ( LangPackStringDeleted) () LangPackStringClass { return & }

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

	_ LangPackStringClass = &LangPackStringDeleted{}
)

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

	return true
}

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

// FillFrom fills LangPackStringDeleted from given interface.
func ( *LangPackStringDeleted) ( interface {
	() ( string)
}) {
	.Key = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *LangPackStringDeleted) () tdp.Type {
	 := tdp.Type{
		Name: "langPackStringDeleted",
		ID:   LangPackStringDeletedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Key",
			SchemaName: "key",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *LangPackStringDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackStringDeleted#2979eeb2 as nil")
	}
	.PutID(LangPackStringDeletedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *LangPackStringDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode langPackStringDeleted#2979eeb2 as nil")
	}
	.PutString(.Key)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *LangPackStringDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode langPackStringDeleted#2979eeb2 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode langPackStringDeleted#2979eeb2: field key: %w", )
		}
		.Key = 
	}
	return nil
}

// GetKey returns value of Key field.
func ( *LangPackStringDeleted) () ( string) {
	if  == nil {
		return
	}
	return .Key
}

// LangPackStringClassName is schema name of LangPackStringClass.
const LangPackStringClassName = "LangPackString"

// LangPackStringClass represents LangPackString generic type.
//
// See https://core.telegram.org/type/LangPackString for reference.
//
// Example:
//
//	g, err := tg.DecodeLangPackString(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.LangPackString: // langPackString#cad181f6
//	case *tg.LangPackStringPluralized: // langPackStringPluralized#6c47ac9f
//	case *tg.LangPackStringDeleted: // langPackStringDeleted#2979eeb2
//	default: panic(v)
//	}
type LangPackStringClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() LangPackStringClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool

	// Language key
	GetKey() (value string)
}

// DecodeLangPackString implements binary de-serialization for LangPackStringClass.
func ( *bin.Buffer) (LangPackStringClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case LangPackStringTypeID:
		// Decoding langPackString#cad181f6.
		 := LangPackString{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode LangPackStringClass: %w", )
		}
		return &, nil
	case LangPackStringPluralizedTypeID:
		// Decoding langPackStringPluralized#6c47ac9f.
		 := LangPackStringPluralized{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode LangPackStringClass: %w", )
		}
		return &, nil
	case LangPackStringDeletedTypeID:
		// Decoding langPackStringDeleted#2979eeb2.
		 := LangPackStringDeleted{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode LangPackStringClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode LangPackStringClass: %w", bin.NewUnexpectedID())
	}
}

// LangPackString boxes the LangPackStringClass providing a helper.
type LangPackStringBox struct {
	LangPackString LangPackStringClass
}

// Decode implements bin.Decoder for LangPackStringBox.
func ( *LangPackStringBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode LangPackStringBox to nil")
	}
	,  := DecodeLangPackString()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.LangPackString = 
	return nil
}

// Encode implements bin.Encode for LangPackStringBox.
func ( *LangPackStringBox) ( *bin.Buffer) error {
	if  == nil || .LangPackString == nil {
		return fmt.Errorf("unable to encode LangPackStringClass as nil")
	}
	return .LangPackString.Encode()
}