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

// AccountResetAuthorizationRequest represents TL type `account.resetAuthorization#df77f3bc`.
// Log out an active authorized sessionĀ¹ by its hash
//
// Links:
//  1. https://core.telegram.org/api/auth
//
// See https://core.telegram.org/method/account.resetAuthorization for reference.
type AccountResetAuthorizationRequest struct {
	// Session hash
	Hash int64
}

// AccountResetAuthorizationRequestTypeID is TL type id of AccountResetAuthorizationRequest.
const AccountResetAuthorizationRequestTypeID = 0xdf77f3bc

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

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

	return true
}

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

// FillFrom fills AccountResetAuthorizationRequest from given interface.
func ( *AccountResetAuthorizationRequest) ( interface {
	() ( int64)
}) {
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountResetAuthorizationRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.resetAuthorization",
		ID:   AccountResetAuthorizationRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountResetAuthorizationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetAuthorization#df77f3bc as nil")
	}
	.PutID(AccountResetAuthorizationRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountResetAuthorizationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetAuthorization#df77f3bc as nil")
	}
	.PutLong(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountResetAuthorizationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.resetAuthorization#df77f3bc to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode account.resetAuthorization#df77f3bc: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetHash returns value of Hash field.
func ( *AccountResetAuthorizationRequest) () ( int64) {
	if  == nil {
		return
	}
	return .Hash
}

// AccountResetAuthorization invokes method account.resetAuthorization#df77f3bc returning error if any.
// Log out an active authorized sessionĀ¹ by its hash
//
// Links:
//  1. https://core.telegram.org/api/auth
//
// Possible errors:
//
//	406 FRESH_RESET_AUTHORISATION_FORBIDDEN: You can't logout other sessions if less than 24 hours have passed since you logged on the current session.
//	400 HASH_INVALID: The provided hash is invalid.
//
// See https://core.telegram.org/method/account.resetAuthorization for reference.
func ( *Client) ( context.Context,  int64) (bool, error) {
	var  BoolBox

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