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

// StoriesReportRequest represents TL type `stories.report#1923fa8c`.
// Report a story.
//
// See https://core.telegram.org/method/stories.report for reference.
type StoriesReportRequest struct {
	// The peer that uploaded the story.
	Peer InputPeerClass
	// IDs of the stories to report.
	ID []int
	// Why are these storeis being reported.
	Reason ReportReasonClass
	// Comment for report moderation
	Message string
}

// StoriesReportRequestTypeID is TL type id of StoriesReportRequest.
const StoriesReportRequestTypeID = 0x1923fa8c

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

func ( *StoriesReportRequest) () 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 ( *StoriesReportRequest) () string {
	if  == nil {
		return "StoriesReportRequest(nil)"
	}
	type  StoriesReportRequest
	return fmt.Sprintf("StoriesReportRequest%+v", (*))
}

// FillFrom fills StoriesReportRequest from given interface.
func ( *StoriesReportRequest) ( 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 (*StoriesReportRequest) () uint32 {
	return StoriesReportRequestTypeID
}

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

// TypeInfo returns info about TL type.
func ( *StoriesReportRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stories.report",
		ID:   StoriesReportRequestTypeID,
	}
	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 ( *StoriesReportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.report#1923fa8c as nil")
	}
	.PutID(StoriesReportRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *StoriesReportRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stories.report#1923fa8c to nil")
	}
	if  := .ConsumeID(StoriesReportRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode stories.report#1923fa8c: %w", )
	}
	return .DecodeBare()
}

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

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

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

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

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

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

// StoriesReport invokes method stories.report#1923fa8c returning error if any.
// Report a story.
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/stories.report for reference.
func ( *Client) ( context.Context,  *StoriesReportRequest) (bool, error) {
	var  BoolBox

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