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

// MessagesTranslateResult represents TL type `messages.translateResult#33db32f8`.
// Translated text with entities¹
//
// Links:
//  1. https://core.telegram.org/api/entities
//
// See https://core.telegram.org/constructor/messages.translateResult for reference.
type MessagesTranslateResult struct {
	// Text+entities¹, for each input message.
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	Result []TextWithEntities
}

// MessagesTranslateResultTypeID is TL type id of MessagesTranslateResult.
const MessagesTranslateResultTypeID = 0x33db32f8

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

func ( *MessagesTranslateResult) () bool {
	if  == nil {
		return true
	}
	if !(.Result == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesTranslateResult from given interface.
func ( *MessagesTranslateResult) ( interface {
	() ( []TextWithEntities)
}) {
	.Result = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesTranslateResult) () string {
	return "messages.translateResult"
}

// TypeInfo returns info about TL type.
func ( *MessagesTranslateResult) () tdp.Type {
	 := tdp.Type{
		Name: "messages.translateResult",
		ID:   MessagesTranslateResultTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Result",
			SchemaName: "result",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesTranslateResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.translateResult#33db32f8 as nil")
	}
	.PutID(MessagesTranslateResultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesTranslateResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.translateResult#33db32f8 as nil")
	}
	.PutVectorHeader(len(.Result))
	for ,  := range .Result {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.translateResult#33db32f8: field result element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesTranslateResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.translateResult#33db32f8 to nil")
	}
	if  := .ConsumeID(MessagesTranslateResultTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.translateResult#33db32f8: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesTranslateResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.translateResult#33db32f8 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.translateResult#33db32f8: field result: %w", )
		}

		if  > 0 {
			.Result = make([]TextWithEntities, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  TextWithEntities
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.translateResult#33db32f8: field result: %w", )
			}
			.Result = append(.Result, )
		}
	}
	return nil
}

// GetResult returns value of Result field.
func ( *MessagesTranslateResult) () ( []TextWithEntities) {
	if  == nil {
		return
	}
	return .Result
}