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

// MessagesEditChatTitleRequest represents TL type `messages.editChatTitle#73783ffd`.
// Changes chat name and sends a service message on it.
//
// See https://core.telegram.org/method/messages.editChatTitle for reference.
type MessagesEditChatTitleRequest struct {
	// Chat ID
	ChatID int64
	// New chat name, different from the old one
	Title string
}

// MessagesEditChatTitleRequestTypeID is TL type id of MessagesEditChatTitleRequest.
const MessagesEditChatTitleRequestTypeID = 0x73783ffd

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

func ( *MessagesEditChatTitleRequest) () bool {
	if  == nil {
		return true
	}
	if !(.ChatID == 0) {
		return false
	}
	if !(.Title == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesEditChatTitleRequest from given interface.
func ( *MessagesEditChatTitleRequest) ( interface {
	() ( int64)
	() ( string)
}) {
	.ChatID = .()
	.Title = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesEditChatTitleRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.editChatTitle",
		ID:   MessagesEditChatTitleRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ChatID",
			SchemaName: "chat_id",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesEditChatTitleRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatTitle#73783ffd as nil")
	}
	.PutID(MessagesEditChatTitleRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesEditChatTitleRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatTitle#73783ffd as nil")
	}
	.PutLong(.ChatID)
	.PutString(.Title)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesEditChatTitleRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.editChatTitle#73783ffd to nil")
	}
	if  := .ConsumeID(MessagesEditChatTitleRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.editChatTitle#73783ffd: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesEditChatTitleRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.editChatTitle#73783ffd to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatTitle#73783ffd: field chat_id: %w", )
		}
		.ChatID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatTitle#73783ffd: field title: %w", )
		}
		.Title = 
	}
	return nil
}

// GetChatID returns value of ChatID field.
func ( *MessagesEditChatTitleRequest) () ( int64) {
	if  == nil {
		return
	}
	return .ChatID
}

// GetTitle returns value of Title field.
func ( *MessagesEditChatTitleRequest) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// MessagesEditChatTitle invokes method messages.editChatTitle#73783ffd returning error if any.
// Changes chat name and sends a service message on it.
//
// Possible errors:
//
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//	400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information.
//	400 CHAT_TITLE_EMPTY: No chat title provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.editChatTitle for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesEditChatTitleRequest) (UpdatesClass, error) {
	var  UpdatesBox

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