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

// BotsSetJoinChatResultsRequest represents TL type `bots.setJoinChatResults#e71a4810`.
//
// See https://core.telegram.org/method/bots.setJoinChatResults for reference.
type BotsSetJoinChatResultsRequest struct {
	// QueryID field of BotsSetJoinChatResultsRequest.
	QueryID int64
	// Result field of BotsSetJoinChatResultsRequest.
	Result JoinChatBotResultClass
}

// BotsSetJoinChatResultsRequestTypeID is TL type id of BotsSetJoinChatResultsRequest.
const BotsSetJoinChatResultsRequestTypeID = 0xe71a4810

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

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

	return true
}

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

// FillFrom fills BotsSetJoinChatResultsRequest from given interface.
func ( *BotsSetJoinChatResultsRequest) ( interface {
	() ( int64)
	() ( JoinChatBotResultClass)
}) {
	.QueryID = .()
	.Result = .()
}

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

// TypeName returns name of type in TL schema.
func (*BotsSetJoinChatResultsRequest) () string {
	return "bots.setJoinChatResults"
}

// TypeInfo returns info about TL type.
func ( *BotsSetJoinChatResultsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.setJoinChatResults",
		ID:   BotsSetJoinChatResultsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "QueryID",
			SchemaName: "query_id",
		},
		{
			Name:       "Result",
			SchemaName: "result",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BotsSetJoinChatResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.setJoinChatResults#e71a4810 as nil")
	}
	.PutID(BotsSetJoinChatResultsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsSetJoinChatResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.setJoinChatResults#e71a4810 as nil")
	}
	.PutLong(.QueryID)
	if .Result == nil {
		return fmt.Errorf("unable to encode bots.setJoinChatResults#e71a4810: field result is nil")
	}
	if  := .Result.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.setJoinChatResults#e71a4810: field result: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotsSetJoinChatResultsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.setJoinChatResults#e71a4810 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setJoinChatResults#e71a4810: field query_id: %w", )
		}
		.QueryID = 
	}
	{
		,  := DecodeJoinChatBotResult()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setJoinChatResults#e71a4810: field result: %w", )
		}
		.Result = 
	}
	return nil
}

// GetQueryID returns value of QueryID field.
func ( *BotsSetJoinChatResultsRequest) () ( int64) {
	if  == nil {
		return
	}
	return .QueryID
}

// GetResult returns value of Result field.
func ( *BotsSetJoinChatResultsRequest) () ( JoinChatBotResultClass) {
	if  == nil {
		return
	}
	return .Result
}

// BotsSetJoinChatResults invokes method bots.setJoinChatResults#e71a4810 returning error if any.
//
// See https://core.telegram.org/method/bots.setJoinChatResults for reference.
func ( *Client) ( context.Context,  *BotsSetJoinChatResultsRequest) (bool, error) {
	var  BoolBox

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