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

// MessagesMigrateChatRequest represents TL type `messages.migrateChat#a2875319`.
// Turn a basic group into a supergroup¹
//
// Links:
//  1. https://core.telegram.org/api/channel#migration
//
// See https://core.telegram.org/method/messages.migrateChat for reference.
type MessagesMigrateChatRequest struct {
	// Basic group¹ to migrate
	//
	// Links:
	//  1) https://core.telegram.org/api/channel#basic-groups
	ChatID int64
}

// MessagesMigrateChatRequestTypeID is TL type id of MessagesMigrateChatRequest.
const MessagesMigrateChatRequestTypeID = 0xa2875319

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesMigrateChatRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.migrateChat#a2875319 as nil")
	}
	.PutID(MessagesMigrateChatRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesMigrateChatRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.migrateChat#a2875319 as nil")
	}
	.PutLong(.ChatID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesMigrateChatRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.migrateChat#a2875319 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.migrateChat#a2875319: field chat_id: %w", )
		}
		.ChatID = 
	}
	return nil
}

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

// MessagesMigrateChat invokes method messages.migrateChat#a2875319 returning error if any.
// Turn a basic group into a supergroup¹
//
// Links:
//  1. https://core.telegram.org/api/channel#migration
//
// Possible errors:
//
//	400 CHANNELS_TOO_MUCH: You have joined too many channels/supergroups.
//	403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//	500 CHAT_INVALID: Invalid chat.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.migrateChat for reference.
func ( *Client) ( context.Context,  int64) (UpdatesClass, error) {
	var  UpdatesBox

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