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

// AccountUpdateStatusRequest represents TL type `account.updateStatus#6628562c`.
// Updates online user status.
//
// See https://core.telegram.org/method/account.updateStatus for reference.
type AccountUpdateStatusRequest struct {
	// If (boolTrue)¹ is transmitted, user status will change to (userStatusOffline)².
	//
	// Links:
	//  1) https://core.telegram.org/constructor/boolTrue
	//  2) https://core.telegram.org/constructor/userStatusOffline
	Offline bool
}

// AccountUpdateStatusRequestTypeID is TL type id of AccountUpdateStatusRequest.
const AccountUpdateStatusRequestTypeID = 0x6628562c

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

func ( *AccountUpdateStatusRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Offline == false) {
		return false
	}

	return true
}

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

// FillFrom fills AccountUpdateStatusRequest from given interface.
func ( *AccountUpdateStatusRequest) ( interface {
	() ( bool)
}) {
	.Offline = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountUpdateStatusRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.updateStatus",
		ID:   AccountUpdateStatusRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Offline",
			SchemaName: "offline",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountUpdateStatusRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateStatus#6628562c as nil")
	}
	.PutID(AccountUpdateStatusRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountUpdateStatusRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateStatus#6628562c as nil")
	}
	.PutBool(.Offline)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountUpdateStatusRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateStatus#6628562c to nil")
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode account.updateStatus#6628562c: field offline: %w", )
		}
		.Offline = 
	}
	return nil
}

// GetOffline returns value of Offline field.
func ( *AccountUpdateStatusRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Offline
}

// AccountUpdateStatus invokes method account.updateStatus#6628562c returning error if any.
// Updates online user status.
//
// See https://core.telegram.org/method/account.updateStatus for reference.
func ( *Client) ( context.Context,  bool) (bool, error) {
	var  BoolBox

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