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

// AccountSetGlobalPrivacySettingsRequest represents TL type `account.setGlobalPrivacySettings#1edaaac2`.
// Set global privacy settings
//
// See https://core.telegram.org/method/account.setGlobalPrivacySettings for reference.
type AccountSetGlobalPrivacySettingsRequest struct {
	// Global privacy settings
	Settings GlobalPrivacySettings
}

// AccountSetGlobalPrivacySettingsRequestTypeID is TL type id of AccountSetGlobalPrivacySettingsRequest.
const AccountSetGlobalPrivacySettingsRequestTypeID = 0x1edaaac2

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

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

	return true
}

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

// FillFrom fills AccountSetGlobalPrivacySettingsRequest from given interface.
func ( *AccountSetGlobalPrivacySettingsRequest) ( interface {
	() ( GlobalPrivacySettings)
}) {
	.Settings = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *AccountSetGlobalPrivacySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.setGlobalPrivacySettings#1edaaac2 as nil")
	}
	.PutID(AccountSetGlobalPrivacySettingsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountSetGlobalPrivacySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.setGlobalPrivacySettings#1edaaac2 as nil")
	}
	if  := .Settings.Encode();  != nil {
		return fmt.Errorf("unable to encode account.setGlobalPrivacySettings#1edaaac2: field settings: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountSetGlobalPrivacySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.setGlobalPrivacySettings#1edaaac2 to nil")
	}
	if  := .ConsumeID(AccountSetGlobalPrivacySettingsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.setGlobalPrivacySettings#1edaaac2: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountSetGlobalPrivacySettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.setGlobalPrivacySettings#1edaaac2 to nil")
	}
	{
		if  := .Settings.Decode();  != nil {
			return fmt.Errorf("unable to decode account.setGlobalPrivacySettings#1edaaac2: field settings: %w", )
		}
	}
	return nil
}

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

// AccountSetGlobalPrivacySettings invokes method account.setGlobalPrivacySettings#1edaaac2 returning error if any.
// Set global privacy settings
//
// Possible errors:
//
//	400 AUTOARCHIVE_NOT_AVAILABLE: The autoarchive setting is not available at this time: please check the value of the autoarchive_setting_available field in client config ยป before calling this method.
//
// See https://core.telegram.org/method/account.setGlobalPrivacySettings for reference.
func ( *Client) ( context.Context,  GlobalPrivacySettings) (*GlobalPrivacySettings, error) {
	var  GlobalPrivacySettings

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