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

// MessagesDeleteChatRequest represents TL type `messages.deleteChat#5bd0ee50`.
// Delete a chat¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/messages.deleteChat for reference.
type MessagesDeleteChatRequest struct {
	// Chat ID
	ChatID int64
}

// MessagesDeleteChatRequestTypeID is TL type id of MessagesDeleteChatRequest.
const MessagesDeleteChatRequestTypeID = 0x5bd0ee50

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesDeleteChatRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.deleteChat#5bd0ee50 as nil")
	}
	.PutID(MessagesDeleteChatRequestTypeID)
	return .EncodeBare()
}

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

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

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

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

// MessagesDeleteChat invokes method messages.deleteChat#5bd0ee50 returning error if any.
// Delete a chat¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// Possible errors:
//
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.deleteChat for reference.
func ( *Client) ( context.Context,  int64) (bool, error) {
	var  BoolBox

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