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

// AccountDisablePeerConnectedBotRequest represents TL type `account.disablePeerConnectedBot#5e437ed9`.
// Permanently disconnect a specific chat from all business bots »¹ (equivalent to
// specifying it in recipients.exclude_users during initial configuration with account
// updateConnectedBot »²); to reconnect of a chat disconnected using this method the
// user must reconnect the entire bot by invoking account.updateConnectedBot »³.
//
// Links:
//  1. https://core.telegram.org/api/bots/connected-business-bots
//  2. https://core.telegram.org/method/account.updateConnectedBot
//  3. https://core.telegram.org/method/account.updateConnectedBot
//
// See https://core.telegram.org/method/account.disablePeerConnectedBot for reference.
type AccountDisablePeerConnectedBotRequest struct {
	// The chat to disconnect
	Peer InputPeerClass
}

// AccountDisablePeerConnectedBotRequestTypeID is TL type id of AccountDisablePeerConnectedBotRequest.
const AccountDisablePeerConnectedBotRequestTypeID = 0x5e437ed9

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

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

	return true
}

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

// FillFrom fills AccountDisablePeerConnectedBotRequest from given interface.
func ( *AccountDisablePeerConnectedBotRequest) ( interface {
	() ( InputPeerClass)
}) {
	.Peer = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountDisablePeerConnectedBotRequest) () string {
	return "account.disablePeerConnectedBot"
}

// TypeInfo returns info about TL type.
func ( *AccountDisablePeerConnectedBotRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.disablePeerConnectedBot",
		ID:   AccountDisablePeerConnectedBotRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountDisablePeerConnectedBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.disablePeerConnectedBot#5e437ed9 as nil")
	}
	.PutID(AccountDisablePeerConnectedBotRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountDisablePeerConnectedBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.disablePeerConnectedBot#5e437ed9 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode account.disablePeerConnectedBot#5e437ed9: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode account.disablePeerConnectedBot#5e437ed9: field peer: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountDisablePeerConnectedBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.disablePeerConnectedBot#5e437ed9 to nil")
	}
	if  := .ConsumeID(AccountDisablePeerConnectedBotRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.disablePeerConnectedBot#5e437ed9: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountDisablePeerConnectedBotRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.disablePeerConnectedBot#5e437ed9 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode account.disablePeerConnectedBot#5e437ed9: field peer: %w", )
		}
		.Peer = 
	}
	return nil
}

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

// AccountDisablePeerConnectedBot invokes method account.disablePeerConnectedBot#5e437ed9 returning error if any.
// Permanently disconnect a specific chat from all business bots »¹ (equivalent to
// specifying it in recipients.exclude_users during initial configuration with account
// updateConnectedBot »²); to reconnect of a chat disconnected using this method the
// user must reconnect the entire bot by invoking account.updateConnectedBot »³.
//
// Links:
//  1. https://core.telegram.org/api/bots/connected-business-bots
//  2. https://core.telegram.org/method/account.updateConnectedBot
//  3. https://core.telegram.org/method/account.updateConnectedBot
//
// Possible errors:
//
//	400 BOT_ALREADY_DISABLED: The connected business bot was already disabled for the specified peer.
//	400 BOT_NOT_CONNECTED_YET: No business bot is connected to the currently logged in user.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/account.disablePeerConnectedBot for reference.
func ( *Client) ( context.Context,  InputPeerClass) (bool, error) {
	var  BoolBox

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