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

// AccountGetPrivacyRequest represents TL type `account.getPrivacy#dadbc950`.
// Get privacy settings of current account
//
// See https://core.telegram.org/method/account.getPrivacy for reference.
type AccountGetPrivacyRequest struct {
	// Peer category whose privacy settings should be fetched
	Key InputPrivacyKeyClass
}

// AccountGetPrivacyRequestTypeID is TL type id of AccountGetPrivacyRequest.
const AccountGetPrivacyRequestTypeID = 0xdadbc950

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

func ( *AccountGetPrivacyRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Key == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AccountGetPrivacyRequest from given interface.
func ( *AccountGetPrivacyRequest) ( interface {
	() ( InputPrivacyKeyClass)
}) {
	.Key = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountGetPrivacyRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.getPrivacy",
		ID:   AccountGetPrivacyRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Key",
			SchemaName: "key",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountGetPrivacyRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getPrivacy#dadbc950 as nil")
	}
	.PutID(AccountGetPrivacyRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountGetPrivacyRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getPrivacy#dadbc950 as nil")
	}
	if .Key == nil {
		return fmt.Errorf("unable to encode account.getPrivacy#dadbc950: field key is nil")
	}
	if  := .Key.Encode();  != nil {
		return fmt.Errorf("unable to encode account.getPrivacy#dadbc950: field key: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountGetPrivacyRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.getPrivacy#dadbc950 to nil")
	}
	{
		,  := DecodeInputPrivacyKey()
		if  != nil {
			return fmt.Errorf("unable to decode account.getPrivacy#dadbc950: field key: %w", )
		}
		.Key = 
	}
	return nil
}

// GetKey returns value of Key field.
func ( *AccountGetPrivacyRequest) () ( InputPrivacyKeyClass) {
	if  == nil {
		return
	}
	return .Key
}

// AccountGetPrivacy invokes method account.getPrivacy#dadbc950 returning error if any.
// Get privacy settings of current account
//
// Possible errors:
//
//	400 PRIVACY_KEY_INVALID: The privacy key is invalid.
//
// See https://core.telegram.org/method/account.getPrivacy for reference.
func ( *Client) ( context.Context,  InputPrivacyKeyClass) (*AccountPrivacyRules, error) {
	var  AccountPrivacyRules

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