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

// HelpEditUserInfoRequest represents TL type `help.editUserInfo#66b91b70`.
// Internal use
//
// See https://core.telegram.org/method/help.editUserInfo for reference.
type HelpEditUserInfoRequest struct {
	// User
	UserID InputUserClass
	// Message
	Message string
	// Message entities for styled text¹
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	Entities []MessageEntityClass
}

// HelpEditUserInfoRequestTypeID is TL type id of HelpEditUserInfoRequest.
const HelpEditUserInfoRequestTypeID = 0x66b91b70

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

func ( *HelpEditUserInfoRequest) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == nil) {
		return false
	}
	if !(.Message == "") {
		return false
	}
	if !(.Entities == nil) {
		return false
	}

	return true
}

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

// FillFrom fills HelpEditUserInfoRequest from given interface.
func ( *HelpEditUserInfoRequest) ( interface {
	() ( InputUserClass)
	() ( string)
	() ( []MessageEntityClass)
}) {
	.UserID = .()
	.Message = .()
	.Entities = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *HelpEditUserInfoRequest) () tdp.Type {
	 := tdp.Type{
		Name: "help.editUserInfo",
		ID:   HelpEditUserInfoRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
		{
			Name:       "Entities",
			SchemaName: "entities",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HelpEditUserInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.editUserInfo#66b91b70 as nil")
	}
	.PutID(HelpEditUserInfoRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpEditUserInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.editUserInfo#66b91b70 as nil")
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode help.editUserInfo#66b91b70: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode help.editUserInfo#66b91b70: field user_id: %w", )
	}
	.PutString(.Message)
	.PutVectorHeader(len(.Entities))
	for ,  := range .Entities {
		if  == nil {
			return fmt.Errorf("unable to encode help.editUserInfo#66b91b70: field entities element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode help.editUserInfo#66b91b70: field entities element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *HelpEditUserInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.editUserInfo#66b91b70 to nil")
	}
	if  := .ConsumeID(HelpEditUserInfoRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode help.editUserInfo#66b91b70: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *HelpEditUserInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.editUserInfo#66b91b70 to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode help.editUserInfo#66b91b70: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode help.editUserInfo#66b91b70: field message: %w", )
		}
		.Message = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode help.editUserInfo#66b91b70: field entities: %w", )
		}

		if  > 0 {
			.Entities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode help.editUserInfo#66b91b70: field entities: %w", )
			}
			.Entities = append(.Entities, )
		}
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *HelpEditUserInfoRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

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

// GetEntities returns value of Entities field.
func ( *HelpEditUserInfoRequest) () ( []MessageEntityClass) {
	if  == nil {
		return
	}
	return .Entities
}

// MapEntities returns field Entities wrapped in MessageEntityClassArray helper.
func ( *HelpEditUserInfoRequest) () ( MessageEntityClassArray) {
	return MessageEntityClassArray(.Entities)
}

// HelpEditUserInfo invokes method help.editUserInfo#66b91b70 returning error if any.
// Internal use
//
// Possible errors:
//
//	400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length.
//	403 USER_INVALID: Invalid user provided.
//
// See https://core.telegram.org/method/help.editUserInfo for reference.
func ( *Client) ( context.Context,  *HelpEditUserInfoRequest) (HelpUserInfoClass, error) {
	var  HelpUserInfoBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .UserInfo, nil
}