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

// PaymentFormMethod represents TL type `paymentFormMethod#88f8f21b`.
// Represents an additional payment method
//
// See https://core.telegram.org/constructor/paymentFormMethod for reference.
type PaymentFormMethod struct {
	// URL to open in a webview to process the payment
	URL string
	// Payment method description
	Title string
}

// PaymentFormMethodTypeID is TL type id of PaymentFormMethod.
const PaymentFormMethodTypeID = 0x88f8f21b

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

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

	return true
}

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

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

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

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

// TypeInfo returns info about TL type.
func ( *PaymentFormMethod) () tdp.Type {
	 := tdp.Type{
		Name: "paymentFormMethod",
		ID:   PaymentFormMethodTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentFormMethod) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode paymentFormMethod#88f8f21b as nil")
	}
	.PutID(PaymentFormMethodTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentFormMethod) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode paymentFormMethod#88f8f21b as nil")
	}
	.PutString(.URL)
	.PutString(.Title)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentFormMethod) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode paymentFormMethod#88f8f21b to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode paymentFormMethod#88f8f21b: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode paymentFormMethod#88f8f21b: field title: %w", )
		}
		.Title = 
	}
	return nil
}

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

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