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

// MessagesSetDefaultReactionRequest represents TL type `messages.setDefaultReaction#4f47a016`.
// Change default emoji reaction to use in the quick reaction menu: the value is synced
// across devices and can be fetched using help.getConfig, reactions_default fieldĀ¹.
//
// Links:
//  1. https://core.telegram.org/method/help.getConfig
//
// See https://core.telegram.org/method/messages.setDefaultReaction for reference.
type MessagesSetDefaultReactionRequest struct {
	// New emoji reaction
	Reaction ReactionClass
}

// MessagesSetDefaultReactionRequestTypeID is TL type id of MessagesSetDefaultReactionRequest.
const MessagesSetDefaultReactionRequestTypeID = 0x4f47a016

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

func ( *MessagesSetDefaultReactionRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Reaction == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesSetDefaultReactionRequest from given interface.
func ( *MessagesSetDefaultReactionRequest) ( interface {
	() ( ReactionClass)
}) {
	.Reaction = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesSetDefaultReactionRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.setDefaultReaction",
		ID:   MessagesSetDefaultReactionRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Reaction",
			SchemaName: "reaction",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesSetDefaultReactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.setDefaultReaction#4f47a016 as nil")
	}
	.PutID(MessagesSetDefaultReactionRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesSetDefaultReactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.setDefaultReaction#4f47a016 as nil")
	}
	if .Reaction == nil {
		return fmt.Errorf("unable to encode messages.setDefaultReaction#4f47a016: field reaction is nil")
	}
	if  := .Reaction.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.setDefaultReaction#4f47a016: field reaction: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesSetDefaultReactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.setDefaultReaction#4f47a016 to nil")
	}
	if  := .ConsumeID(MessagesSetDefaultReactionRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.setDefaultReaction#4f47a016: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesSetDefaultReactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.setDefaultReaction#4f47a016 to nil")
	}
	{
		,  := DecodeReaction()
		if  != nil {
			return fmt.Errorf("unable to decode messages.setDefaultReaction#4f47a016: field reaction: %w", )
		}
		.Reaction = 
	}
	return nil
}

// GetReaction returns value of Reaction field.
func ( *MessagesSetDefaultReactionRequest) () ( ReactionClass) {
	if  == nil {
		return
	}
	return .Reaction
}

// MessagesSetDefaultReaction invokes method messages.setDefaultReaction#4f47a016 returning error if any.
// Change default emoji reaction to use in the quick reaction menu: the value is synced
// across devices and can be fetched using help.getConfig, reactions_default fieldĀ¹.
//
// Links:
//  1. https://core.telegram.org/method/help.getConfig
//
// Possible errors:
//
//	400 REACTION_INVALID: The specified reaction is invalid.
//
// See https://core.telegram.org/method/messages.setDefaultReaction for reference.
func ( *Client) ( context.Context,  ReactionClass) (bool, error) {
	var  BoolBox

	 := &MessagesSetDefaultReactionRequest{
		Reaction: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}