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

// ChannelsGetChannelRecommendationsRequest represents TL type `channels.getChannelRecommendations#83b70d97`.
// Obtain a list of similarly themed public channels, selected based on similarities in
// their subscriber bases.
//
// See https://core.telegram.org/method/channels.getChannelRecommendations for reference.
type ChannelsGetChannelRecommendationsRequest struct {
	// The method will return channels related to the passed channel.
	Channel InputChannelClass
}

// ChannelsGetChannelRecommendationsRequestTypeID is TL type id of ChannelsGetChannelRecommendationsRequest.
const ChannelsGetChannelRecommendationsRequestTypeID = 0x83b70d97

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

func ( *ChannelsGetChannelRecommendationsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Channel == nil) {
		return false
	}

	return true
}

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

// FillFrom fills ChannelsGetChannelRecommendationsRequest from given interface.
func ( *ChannelsGetChannelRecommendationsRequest) ( interface {
	() ( InputChannelClass)
}) {
	.Channel = .()
}

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

// TypeName returns name of type in TL schema.
func (*ChannelsGetChannelRecommendationsRequest) () string {
	return "channels.getChannelRecommendations"
}

// TypeInfo returns info about TL type.
func ( *ChannelsGetChannelRecommendationsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.getChannelRecommendations",
		ID:   ChannelsGetChannelRecommendationsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsGetChannelRecommendationsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getChannelRecommendations#83b70d97 as nil")
	}
	.PutID(ChannelsGetChannelRecommendationsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsGetChannelRecommendationsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getChannelRecommendations#83b70d97 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.getChannelRecommendations#83b70d97: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.getChannelRecommendations#83b70d97: field channel: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelsGetChannelRecommendationsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.getChannelRecommendations#83b70d97 to nil")
	}
	if  := .ConsumeID(ChannelsGetChannelRecommendationsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.getChannelRecommendations#83b70d97: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsGetChannelRecommendationsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.getChannelRecommendations#83b70d97 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.getChannelRecommendations#83b70d97: field channel: %w", )
		}
		.Channel = 
	}
	return nil
}

// GetChannel returns value of Channel field.
func ( *ChannelsGetChannelRecommendationsRequest) () ( InputChannelClass) {
	if  == nil {
		return
	}
	return .Channel
}

// GetChannelAsNotEmpty returns mapped value of Channel field.
func ( *ChannelsGetChannelRecommendationsRequest) () (NotEmptyInputChannel, bool) {
	return .Channel.AsNotEmpty()
}

// ChannelsGetChannelRecommendations invokes method channels.getChannelRecommendations#83b70d97 returning error if any.
// Obtain a list of similarly themed public channels, selected based on similarities in
// their subscriber bases.
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//
// See https://core.telegram.org/method/channels.getChannelRecommendations for reference.
func ( *Client) ( context.Context,  InputChannelClass) (MessagesChatsClass, error) {
	var  MessagesChatsBox

	 := &ChannelsGetChannelRecommendationsRequest{
		Channel: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Chats, nil
}