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

// PendingSuggestion represents TL type `pendingSuggestion#e7e82e12`.
// Represents a custom pending suggestion »¹.
//
// Links:
//  1. https://core.telegram.org/api/config#custom-suggestions
//
// See https://core.telegram.org/constructor/pendingSuggestion for reference.
type PendingSuggestion struct {
	// The suggestion ID, can be passed to help.dismissSuggestion¹.
	//
	// Links:
	//  1) https://core.telegram.org/method/help.dismissSuggestion
	Suggestion string
	// Title of the suggestion.
	Title TextWithEntities
	// Body of the suggestion.
	Description TextWithEntities
	// URL to open when the user clicks on the suggestion.
	URL string
}

// PendingSuggestionTypeID is TL type id of PendingSuggestion.
const PendingSuggestionTypeID = 0xe7e82e12

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

func ( *PendingSuggestion) () bool {
	if  == nil {
		return true
	}
	if !(.Suggestion == "") {
		return false
	}
	if !(.Title.Zero()) {
		return false
	}
	if !(.Description.Zero()) {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills PendingSuggestion from given interface.
func ( *PendingSuggestion) ( interface {
	() ( string)
	() ( TextWithEntities)
	() ( TextWithEntities)
	() ( string)
}) {
	.Suggestion = .()
	.Title = .()
	.Description = .()
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PendingSuggestion) () tdp.Type {
	 := tdp.Type{
		Name: "pendingSuggestion",
		ID:   PendingSuggestionTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Suggestion",
			SchemaName: "suggestion",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Description",
			SchemaName: "description",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PendingSuggestion) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode pendingSuggestion#e7e82e12 as nil")
	}
	.PutID(PendingSuggestionTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PendingSuggestion) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode pendingSuggestion#e7e82e12 as nil")
	}
	.PutString(.Suggestion)
	if  := .Title.Encode();  != nil {
		return fmt.Errorf("unable to encode pendingSuggestion#e7e82e12: field title: %w", )
	}
	if  := .Description.Encode();  != nil {
		return fmt.Errorf("unable to encode pendingSuggestion#e7e82e12: field description: %w", )
	}
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PendingSuggestion) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode pendingSuggestion#e7e82e12 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field suggestion: %w", )
		}
		.Suggestion = 
	}
	{
		if  := .Title.Decode();  != nil {
			return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field title: %w", )
		}
	}
	{
		if  := .Description.Decode();  != nil {
			return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field description: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// GetSuggestion returns value of Suggestion field.
func ( *PendingSuggestion) () ( string) {
	if  == nil {
		return
	}
	return .Suggestion
}

// GetTitle returns value of Title field.
func ( *PendingSuggestion) () ( TextWithEntities) {
	if  == nil {
		return
	}
	return .Title
}

// GetDescription returns value of Description field.
func ( *PendingSuggestion) () ( TextWithEntities) {
	if  == nil {
		return
	}
	return .Description
}

// GetURL returns value of URL field.
func ( *PendingSuggestion) () ( string) {
	if  == nil {
		return
	}
	return .URL
}