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

// PaymentsClearSavedInfoRequest represents TL type `payments.clearSavedInfo#d83d70c1`.
// Clear saved payment information
//
// See https://core.telegram.org/method/payments.clearSavedInfo for reference.
type PaymentsClearSavedInfoRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Remove saved payment credentials
	Credentials bool
	// Clear the last order settings saved by the user
	Info bool
}

// PaymentsClearSavedInfoRequestTypeID is TL type id of PaymentsClearSavedInfoRequest.
const PaymentsClearSavedInfoRequestTypeID = 0xd83d70c1

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

func ( *PaymentsClearSavedInfoRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Credentials == false) {
		return false
	}
	if !(.Info == false) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsClearSavedInfoRequest from given interface.
func ( *PaymentsClearSavedInfoRequest) ( interface {
	() ( bool)
	() ( bool)
}) {
	.Credentials = .()
	.Info = .()
}

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

// TypeName returns name of type in TL schema.
func (*PaymentsClearSavedInfoRequest) () string {
	return "payments.clearSavedInfo"
}

// TypeInfo returns info about TL type.
func ( *PaymentsClearSavedInfoRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.clearSavedInfo",
		ID:   PaymentsClearSavedInfoRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Credentials",
			SchemaName: "credentials",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Info",
			SchemaName: "info",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PaymentsClearSavedInfoRequest) () {
	if !(.Credentials == false) {
		.Flags.Set(0)
	}
	if !(.Info == false) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *PaymentsClearSavedInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.clearSavedInfo#d83d70c1 as nil")
	}
	.PutID(PaymentsClearSavedInfoRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsClearSavedInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.clearSavedInfo#d83d70c1 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.clearSavedInfo#d83d70c1: field flags: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *PaymentsClearSavedInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.clearSavedInfo#d83d70c1 to nil")
	}
	if  := .ConsumeID(PaymentsClearSavedInfoRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.clearSavedInfo#d83d70c1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsClearSavedInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.clearSavedInfo#d83d70c1 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode payments.clearSavedInfo#d83d70c1: field flags: %w", )
		}
	}
	.Credentials = .Flags.Has(0)
	.Info = .Flags.Has(1)
	return nil
}

// SetCredentials sets value of Credentials conditional field.
func ( *PaymentsClearSavedInfoRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Credentials = true
	} else {
		.Flags.Unset(0)
		.Credentials = false
	}
}

// GetCredentials returns value of Credentials conditional field.
func ( *PaymentsClearSavedInfoRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetInfo sets value of Info conditional field.
func ( *PaymentsClearSavedInfoRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.Info = true
	} else {
		.Flags.Unset(1)
		.Info = false
	}
}

// GetInfo returns value of Info conditional field.
func ( *PaymentsClearSavedInfoRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// PaymentsClearSavedInfo invokes method payments.clearSavedInfo#d83d70c1 returning error if any.
// Clear saved payment information
//
// See https://core.telegram.org/method/payments.clearSavedInfo for reference.
func ( *Client) ( context.Context,  *PaymentsClearSavedInfoRequest) (bool, error) {
	var  BoolBox

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