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

// HelpSaveAppLogRequest represents TL type `help.saveAppLog#6f02f748`.
// Saves logs of application on the server.
//
// See https://core.telegram.org/method/help.saveAppLog for reference.
type HelpSaveAppLogRequest struct {
	// List of input events
	Events []InputAppEvent
}

// HelpSaveAppLogRequestTypeID is TL type id of HelpSaveAppLogRequest.
const HelpSaveAppLogRequestTypeID = 0x6f02f748

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

func ( *HelpSaveAppLogRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Events == nil) {
		return false
	}

	return true
}

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

// FillFrom fills HelpSaveAppLogRequest from given interface.
func ( *HelpSaveAppLogRequest) ( interface {
	() ( []InputAppEvent)
}) {
	.Events = .()
}

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

// TypeName returns name of type in TL schema.
func (*HelpSaveAppLogRequest) () string {
	return "help.saveAppLog"
}

// TypeInfo returns info about TL type.
func ( *HelpSaveAppLogRequest) () tdp.Type {
	 := tdp.Type{
		Name: "help.saveAppLog",
		ID:   HelpSaveAppLogRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Events",
			SchemaName: "events",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HelpSaveAppLogRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.saveAppLog#6f02f748 as nil")
	}
	.PutID(HelpSaveAppLogRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpSaveAppLogRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.saveAppLog#6f02f748 as nil")
	}
	.PutVectorHeader(len(.Events))
	for ,  := range .Events {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode help.saveAppLog#6f02f748: field events element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *HelpSaveAppLogRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.saveAppLog#6f02f748 to nil")
	}
	if  := .ConsumeID(HelpSaveAppLogRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode help.saveAppLog#6f02f748: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *HelpSaveAppLogRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.saveAppLog#6f02f748 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode help.saveAppLog#6f02f748: field events: %w", )
		}

		if  > 0 {
			.Events = make([]InputAppEvent, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  InputAppEvent
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode help.saveAppLog#6f02f748: field events: %w", )
			}
			.Events = append(.Events, )
		}
	}
	return nil
}

// GetEvents returns value of Events field.
func ( *HelpSaveAppLogRequest) () ( []InputAppEvent) {
	if  == nil {
		return
	}
	return .Events
}

// HelpSaveAppLog invokes method help.saveAppLog#6f02f748 returning error if any.
// Saves logs of application on the server.
//
// See https://core.telegram.org/method/help.saveAppLog for reference.
func ( *Client) ( context.Context,  []InputAppEvent) (bool, error) {
	var  BoolBox

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