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

// PaymentsBankCardData represents TL type `payments.bankCardData#3e24e573`.
// Credit card info, provided by the card's bank(s)
//
// See https://core.telegram.org/constructor/payments.bankCardData for reference.
type PaymentsBankCardData struct {
	// Credit card title
	Title string
	// Info URL(s) provided by the card's bank(s)
	OpenURLs []BankCardOpenURL
}

// PaymentsBankCardDataTypeID is TL type id of PaymentsBankCardData.
const PaymentsBankCardDataTypeID = 0x3e24e573

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

func ( *PaymentsBankCardData) () bool {
	if  == nil {
		return true
	}
	if !(.Title == "") {
		return false
	}
	if !(.OpenURLs == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsBankCardData from given interface.
func ( *PaymentsBankCardData) ( interface {
	() ( string)
	() ( []BankCardOpenURL)
}) {
	.Title = .()
	.OpenURLs = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsBankCardData) () tdp.Type {
	 := tdp.Type{
		Name: "payments.bankCardData",
		ID:   PaymentsBankCardDataTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "OpenURLs",
			SchemaName: "open_urls",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsBankCardData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.bankCardData#3e24e573 as nil")
	}
	.PutID(PaymentsBankCardDataTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsBankCardData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.bankCardData#3e24e573 as nil")
	}
	.PutString(.Title)
	.PutVectorHeader(len(.OpenURLs))
	for ,  := range .OpenURLs {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode payments.bankCardData#3e24e573: field open_urls element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsBankCardData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.bankCardData#3e24e573 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode payments.bankCardData#3e24e573: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode payments.bankCardData#3e24e573: field open_urls: %w", )
		}

		if  > 0 {
			.OpenURLs = make([]BankCardOpenURL, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  BankCardOpenURL
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode payments.bankCardData#3e24e573: field open_urls: %w", )
			}
			.OpenURLs = append(.OpenURLs, )
		}
	}
	return nil
}

// GetTitle returns value of Title field.
func ( *PaymentsBankCardData) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// GetOpenURLs returns value of OpenURLs field.
func ( *PaymentsBankCardData) () ( []BankCardOpenURL) {
	if  == nil {
		return
	}
	return .OpenURLs
}