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

// PaymentsGetBankCardDataRequest represents TL type `payments.getBankCardData#2e79d779`.
// Get info about a credit card
//
// See https://core.telegram.org/method/payments.getBankCardData for reference.
type PaymentsGetBankCardDataRequest struct {
	// Credit card number
	Number string
}

// PaymentsGetBankCardDataRequestTypeID is TL type id of PaymentsGetBankCardDataRequest.
const PaymentsGetBankCardDataRequestTypeID = 0x2e79d779

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

func ( *PaymentsGetBankCardDataRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Number == "") {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsGetBankCardDataRequest from given interface.
func ( *PaymentsGetBankCardDataRequest) ( interface {
	() ( string)
}) {
	.Number = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsGetBankCardDataRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getBankCardData",
		ID:   PaymentsGetBankCardDataRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Number",
			SchemaName: "number",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetBankCardDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getBankCardData#2e79d779 as nil")
	}
	.PutID(PaymentsGetBankCardDataRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetBankCardDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getBankCardData#2e79d779 as nil")
	}
	.PutString(.Number)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetBankCardDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getBankCardData#2e79d779 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getBankCardData#2e79d779: field number: %w", )
		}
		.Number = 
	}
	return nil
}

// GetNumber returns value of Number field.
func ( *PaymentsGetBankCardDataRequest) () ( string) {
	if  == nil {
		return
	}
	return .Number
}

// PaymentsGetBankCardData invokes method payments.getBankCardData#2e79d779 returning error if any.
// Get info about a credit card
//
// Possible errors:
//
//	400 BANK_CARD_NUMBER_INVALID: The specified card number is invalid.
//
// See https://core.telegram.org/method/payments.getBankCardData for reference.
func ( *Client) ( context.Context,  string) (*PaymentsBankCardData, error) {
	var  PaymentsBankCardData

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