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

// AccountUpdateNotifySettingsRequest represents TL type `account.updateNotifySettings#84be5b93`.
// Edits notification settings from a given user/group, from all users/all groups.
//
// See https://core.telegram.org/method/account.updateNotifySettings for reference.
type AccountUpdateNotifySettingsRequest struct {
	// Notification source
	Peer InputNotifyPeerClass
	// Notification settings
	Settings InputPeerNotifySettings
}

// AccountUpdateNotifySettingsRequestTypeID is TL type id of AccountUpdateNotifySettingsRequest.
const AccountUpdateNotifySettingsRequestTypeID = 0x84be5b93

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

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

	return true
}

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

// FillFrom fills AccountUpdateNotifySettingsRequest from given interface.
func ( *AccountUpdateNotifySettingsRequest) ( interface {
	() ( InputNotifyPeerClass)
	() ( InputPeerNotifySettings)
}) {
	.Peer = .()
	.Settings = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *AccountUpdateNotifySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateNotifySettings#84be5b93 as nil")
	}
	.PutID(AccountUpdateNotifySettingsRequestTypeID)
	return .EncodeBare()
}

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

// Decode implements bin.Decoder.
func ( *AccountUpdateNotifySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateNotifySettings#84be5b93 to nil")
	}
	if  := .ConsumeID(AccountUpdateNotifySettingsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.updateNotifySettings#84be5b93: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountUpdateNotifySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateNotifySettings#84be5b93 to nil")
	}
	{
		,  := DecodeInputNotifyPeer()
		if  != nil {
			return fmt.Errorf("unable to decode account.updateNotifySettings#84be5b93: field peer: %w", )
		}
		.Peer = 
	}
	{
		if  := .Settings.Decode();  != nil {
			return fmt.Errorf("unable to decode account.updateNotifySettings#84be5b93: field settings: %w", )
		}
	}
	return nil
}

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

// GetSettings returns value of Settings field.
func ( *AccountUpdateNotifySettingsRequest) () ( InputPeerNotifySettings) {
	if  == nil {
		return
	}
	return .Settings
}

// AccountUpdateNotifySettings invokes method account.updateNotifySettings#84be5b93 returning error if any.
// Edits notification settings from a given user/group, from all users/all groups.
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 SETTINGS_INVALID: Invalid settings were provided.
//
// See https://core.telegram.org/method/account.updateNotifySettings for reference.
func ( *Client) ( context.Context,  *AccountUpdateNotifySettingsRequest) (bool, error) {
	var  BoolBox

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