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

// AccountUpdateDeviceLockedRequest represents TL type `account.updateDeviceLocked#38df3532`.
// When client-side passcode lock feature is enabled, will not show message texts in
// incoming PUSH notifications¹.
//
// Links:
//  1. https://core.telegram.org/api/push-updates
//
// See https://core.telegram.org/method/account.updateDeviceLocked for reference.
type AccountUpdateDeviceLockedRequest struct {
	// Inactivity period after which to start hiding message texts in PUSH notifications¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/push-updates
	Period int
}

// AccountUpdateDeviceLockedRequestTypeID is TL type id of AccountUpdateDeviceLockedRequest.
const AccountUpdateDeviceLockedRequestTypeID = 0x38df3532

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

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

	return true
}

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

// FillFrom fills AccountUpdateDeviceLockedRequest from given interface.
func ( *AccountUpdateDeviceLockedRequest) ( interface {
	() ( int)
}) {
	.Period = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountUpdateDeviceLockedRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.updateDeviceLocked",
		ID:   AccountUpdateDeviceLockedRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Period",
			SchemaName: "period",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountUpdateDeviceLockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateDeviceLocked#38df3532 as nil")
	}
	.PutID(AccountUpdateDeviceLockedRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountUpdateDeviceLockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateDeviceLocked#38df3532 as nil")
	}
	.PutInt(.Period)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountUpdateDeviceLockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateDeviceLocked#38df3532 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode account.updateDeviceLocked#38df3532: field period: %w", )
		}
		.Period = 
	}
	return nil
}

// GetPeriod returns value of Period field.
func ( *AccountUpdateDeviceLockedRequest) () ( int) {
	if  == nil {
		return
	}
	return .Period
}

// AccountUpdateDeviceLocked invokes method account.updateDeviceLocked#38df3532 returning error if any.
// When client-side passcode lock feature is enabled, will not show message texts in
// incoming PUSH notifications¹.
//
// Links:
//  1. https://core.telegram.org/api/push-updates
//
// See https://core.telegram.org/method/account.updateDeviceLocked for reference.
func ( *Client) ( context.Context,  int) (bool, error) {
	var  BoolBox

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