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

// BankCardOpenURL represents TL type `bankCardOpenUrl#f568028a`.
// Credit card info URL provided by the bank
//
// See https://core.telegram.org/constructor/bankCardOpenUrl for reference.
type BankCardOpenURL struct {
	// Info URL
	URL string
	// Bank name
	Name string
}

// BankCardOpenURLTypeID is TL type id of BankCardOpenURL.
const BankCardOpenURLTypeID = 0xf568028a

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

func ( *BankCardOpenURL) () bool {
	if  == nil {
		return true
	}
	if !(.URL == "") {
		return false
	}
	if !(.Name == "") {
		return false
	}

	return true
}

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

// FillFrom fills BankCardOpenURL from given interface.
func ( *BankCardOpenURL) ( interface {
	() ( string)
	() ( string)
}) {
	.URL = .()
	.Name = .()
}

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

// TypeName returns name of type in TL schema.
func (*BankCardOpenURL) () string {
	return "bankCardOpenUrl"
}

// TypeInfo returns info about TL type.
func ( *BankCardOpenURL) () tdp.Type {
	 := tdp.Type{
		Name: "bankCardOpenUrl",
		ID:   BankCardOpenURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Name",
			SchemaName: "name",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BankCardOpenURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bankCardOpenUrl#f568028a as nil")
	}
	.PutID(BankCardOpenURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BankCardOpenURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bankCardOpenUrl#f568028a as nil")
	}
	.PutString(.URL)
	.PutString(.Name)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BankCardOpenURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bankCardOpenUrl#f568028a to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bankCardOpenUrl#f568028a: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bankCardOpenUrl#f568028a: field name: %w", )
		}
		.Name = 
	}
	return nil
}

// GetURL returns value of URL field.
func ( *BankCardOpenURL) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// GetName returns value of Name field.
func ( *BankCardOpenURL) () ( string) {
	if  == nil {
		return
	}
	return .Name
}