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

// MessagesSetEncryptedTypingRequest represents TL type `messages.setEncryptedTyping#791451ed`.
// Send typing event by the current user to a secret chat.
//
// See https://core.telegram.org/method/messages.setEncryptedTyping for reference.
type MessagesSetEncryptedTypingRequest struct {
	// Secret chat ID
	Peer InputEncryptedChat
	// Typing.Possible values:(boolTrue)¹, if the user started typing and more than 5
	// seconds have passed since the last request(boolFalse)², if the user stopped typing
	//
	// Links:
	//  1) https://core.telegram.org/constructor/boolTrue
	//  2) https://core.telegram.org/constructor/boolFalse
	Typing bool
}

// MessagesSetEncryptedTypingRequestTypeID is TL type id of MessagesSetEncryptedTypingRequest.
const MessagesSetEncryptedTypingRequestTypeID = 0x791451ed

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

func ( *MessagesSetEncryptedTypingRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer.Zero()) {
		return false
	}
	if !(.Typing == false) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesSetEncryptedTypingRequest from given interface.
func ( *MessagesSetEncryptedTypingRequest) ( interface {
	() ( InputEncryptedChat)
	() ( bool)
}) {
	.Peer = .()
	.Typing = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesSetEncryptedTypingRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.setEncryptedTyping",
		ID:   MessagesSetEncryptedTypingRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Typing",
			SchemaName: "typing",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesSetEncryptedTypingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.setEncryptedTyping#791451ed as nil")
	}
	.PutID(MessagesSetEncryptedTypingRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesSetEncryptedTypingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.setEncryptedTyping#791451ed as nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.setEncryptedTyping#791451ed: field peer: %w", )
	}
	.PutBool(.Typing)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesSetEncryptedTypingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.setEncryptedTyping#791451ed to nil")
	}
	if  := .ConsumeID(MessagesSetEncryptedTypingRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.setEncryptedTyping#791451ed: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesSetEncryptedTypingRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.setEncryptedTyping#791451ed to nil")
	}
	{
		if  := .Peer.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.setEncryptedTyping#791451ed: field peer: %w", )
		}
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode messages.setEncryptedTyping#791451ed: field typing: %w", )
		}
		.Typing = 
	}
	return nil
}

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

// GetTyping returns value of Typing field.
func ( *MessagesSetEncryptedTypingRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Typing
}

// MessagesSetEncryptedTyping invokes method messages.setEncryptedTyping#791451ed returning error if any.
// Send typing event by the current user to a secret chat.
//
// Possible errors:
//
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//
// See https://core.telegram.org/method/messages.setEncryptedTyping for reference.
func ( *Client) ( context.Context,  *MessagesSetEncryptedTypingRequest) (bool, error) {
	var  BoolBox

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