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

// MessagesReportRequest represents TL type `messages.report#8953ab4e`.
// Report a message in a chat for violation of telegram's Terms of Service
//
// See https://core.telegram.org/method/messages.report for reference.
type MessagesReportRequest struct {
	// Peer
	Peer InputPeerClass
	// IDs of messages to report
	ID []int
	// Why are these messages being reported
	Reason ReportReasonClass
	// Comment for report moderation
	Message string
}

// MessagesReportRequestTypeID is TL type id of MessagesReportRequest.
const MessagesReportRequestTypeID = 0x8953ab4e

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

func ( *MessagesReportRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == nil) {
		return false
	}
	if !(.Reason == nil) {
		return false
	}
	if !(.Message == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesReportRequest from given interface.
func ( *MessagesReportRequest) ( interface {
	() ( InputPeerClass)
	() ( []int)
	() ( ReportReasonClass)
	() ( string)
}) {
	.Peer = .()
	.ID = .()
	.Reason = .()
	.Message = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesReportRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.report",
		ID:   MessagesReportRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Reason",
			SchemaName: "reason",
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesReportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.report#8953ab4e as nil")
	}
	.PutID(MessagesReportRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesReportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.report#8953ab4e as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.report#8953ab4e: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.report#8953ab4e: field peer: %w", )
	}
	.PutVectorHeader(len(.ID))
	for ,  := range .ID {
		.PutInt()
	}
	if .Reason == nil {
		return fmt.Errorf("unable to encode messages.report#8953ab4e: field reason is nil")
	}
	if  := .Reason.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.report#8953ab4e: field reason: %w", )
	}
	.PutString(.Message)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesReportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.report#8953ab4e to nil")
	}
	if  := .ConsumeID(MessagesReportRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.report#8953ab4e: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesReportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.report#8953ab4e to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.report#8953ab4e: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.report#8953ab4e: field id: %w", )
		}

		if  > 0 {
			.ID = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode messages.report#8953ab4e: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	{
		,  := DecodeReportReason()
		if  != nil {
			return fmt.Errorf("unable to decode messages.report#8953ab4e: field reason: %w", )
		}
		.Reason = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.report#8953ab4e: field message: %w", )
		}
		.Message = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *MessagesReportRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

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

// GetReason returns value of Reason field.
func ( *MessagesReportRequest) () ( ReportReasonClass) {
	if  == nil {
		return
	}
	return .Reason
}

// GetMessage returns value of Message field.
func ( *MessagesReportRequest) () ( string) {
	if  == nil {
		return
	}
	return .Message
}

// MessagesReport invokes method messages.report#8953ab4e returning error if any.
// Report a message in a chat for violation of telegram's Terms of Service
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.report for reference.
func ( *Client) ( context.Context,  *MessagesReportRequest) (bool, error) {
	var  BoolBox

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