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

// AccountReportPeerRequest represents TL type `account.reportPeer#c5ba3d86`.
// Report a peer for violation of telegram's Terms of Service
//
// See https://core.telegram.org/method/account.reportPeer for reference.
type AccountReportPeerRequest struct {
	// The peer to report
	Peer InputPeerClass
	// The reason why this peer is being reported
	Reason ReportReasonClass
	// Comment for report moderation
	Message string
}

// AccountReportPeerRequestTypeID is TL type id of AccountReportPeerRequest.
const AccountReportPeerRequestTypeID = 0xc5ba3d86

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

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

	return true
}

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

// FillFrom fills AccountReportPeerRequest from given interface.
func ( *AccountReportPeerRequest) ( interface {
	() ( InputPeerClass)
	() ( ReportReasonClass)
	() ( string)
}) {
	.Peer = .()
	.Reason = .()
	.Message = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountReportPeerRequest) () string {
	return "account.reportPeer"
}

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

// Encode implements bin.Encoder.
func ( *AccountReportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.reportPeer#c5ba3d86 as nil")
	}
	.PutID(AccountReportPeerRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountReportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.reportPeer#c5ba3d86 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode account.reportPeer#c5ba3d86: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode account.reportPeer#c5ba3d86: field peer: %w", )
	}
	if .Reason == nil {
		return fmt.Errorf("unable to encode account.reportPeer#c5ba3d86: field reason is nil")
	}
	if  := .Reason.Encode();  != nil {
		return fmt.Errorf("unable to encode account.reportPeer#c5ba3d86: field reason: %w", )
	}
	.PutString(.Message)
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountReportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.reportPeer#c5ba3d86 to nil")
	}
	if  := .ConsumeID(AccountReportPeerRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.reportPeer#c5ba3d86: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountReportPeerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.reportPeer#c5ba3d86 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode account.reportPeer#c5ba3d86: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeReportReason()
		if  != nil {
			return fmt.Errorf("unable to decode account.reportPeer#c5ba3d86: field reason: %w", )
		}
		.Reason = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.reportPeer#c5ba3d86: field message: %w", )
		}
		.Message = 
	}
	return nil
}

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

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

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

// AccountReportPeer invokes method account.reportPeer#c5ba3d86 returning error if any.
// Report a peer for violation of telegram's Terms of Service
//
// Possible errors:
//
//	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/account.reportPeer for reference.
func ( *Client) ( context.Context,  *AccountReportPeerRequest) (bool, error) {
	var  BoolBox

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