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

// ChannelsReportSpamRequest represents TL type `channels.reportSpam#f44a8315`.
// Reports some messages from a user in a supergroup as spam; requires administrator
// rights in the supergroup
//
// See https://core.telegram.org/method/channels.reportSpam for reference.
type ChannelsReportSpamRequest struct {
	// Supergroup
	Channel InputChannelClass
	// Participant whose messages should be reported
	Participant InputPeerClass
	// IDs of spam messages
	ID []int
}

// ChannelsReportSpamRequestTypeID is TL type id of ChannelsReportSpamRequest.
const ChannelsReportSpamRequestTypeID = 0xf44a8315

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

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

	return true
}

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

// FillFrom fills ChannelsReportSpamRequest from given interface.
func ( *ChannelsReportSpamRequest) ( interface {
	() ( InputChannelClass)
	() ( InputPeerClass)
	() ( []int)
}) {
	.Channel = .()
	.Participant = .()
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChannelsReportSpamRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.reportSpam",
		ID:   ChannelsReportSpamRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Participant",
			SchemaName: "participant",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsReportSpamRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.reportSpam#f44a8315 as nil")
	}
	.PutID(ChannelsReportSpamRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsReportSpamRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.reportSpam#f44a8315 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.reportSpam#f44a8315: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.reportSpam#f44a8315: field channel: %w", )
	}
	if .Participant == nil {
		return fmt.Errorf("unable to encode channels.reportSpam#f44a8315: field participant is nil")
	}
	if  := .Participant.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.reportSpam#f44a8315: field participant: %w", )
	}
	.PutVectorHeader(len(.ID))
	for ,  := range .ID {
		.PutInt()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsReportSpamRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.reportSpam#f44a8315 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.reportSpam#f44a8315: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode channels.reportSpam#f44a8315: field participant: %w", )
		}
		.Participant = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode channels.reportSpam#f44a8315: field id: %w", )
		}

		if  > 0 {
			.ID = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode channels.reportSpam#f44a8315: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	return nil
}

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

// GetParticipant returns value of Participant field.
func ( *ChannelsReportSpamRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Participant
}

// GetID returns value of ID field.
func ( *ChannelsReportSpamRequest) () ( []int) {
	if  == nil {
		return
	}
	return .ID
}

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

// ChannelsReportSpam invokes method channels.reportSpam#f44a8315 returning error if any.
// Reports some messages from a user in a supergroup as spam; requires administrator
// rights in the supergroup
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/channels.reportSpam for reference.
func ( *Client) ( context.Context,  *ChannelsReportSpamRequest) (bool, error) {
	var  BoolBox

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