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

// PaymentCharge represents TL type `paymentCharge#ea02c27e`.
// Payment identifier
//
// See https://core.telegram.org/constructor/paymentCharge for reference.
type PaymentCharge struct {
	// Telegram payment identifier
	ID string
	// Provider payment identifier
	ProviderChargeID string
}

// PaymentChargeTypeID is TL type id of PaymentCharge.
const PaymentChargeTypeID = 0xea02c27e

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

func ( *PaymentCharge) () bool {
	if  == nil {
		return true
	}
	if !(.ID == "") {
		return false
	}
	if !(.ProviderChargeID == "") {
		return false
	}

	return true
}

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

// FillFrom fills PaymentCharge from given interface.
func ( *PaymentCharge) ( interface {
	() ( string)
	() ( string)
}) {
	.ID = .()
	.ProviderChargeID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentCharge) () tdp.Type {
	 := tdp.Type{
		Name: "paymentCharge",
		ID:   PaymentChargeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "ProviderChargeID",
			SchemaName: "provider_charge_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentCharge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode paymentCharge#ea02c27e as nil")
	}
	.PutID(PaymentChargeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentCharge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode paymentCharge#ea02c27e as nil")
	}
	.PutString(.ID)
	.PutString(.ProviderChargeID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentCharge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode paymentCharge#ea02c27e to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode paymentCharge#ea02c27e: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode paymentCharge#ea02c27e: field provider_charge_id: %w", )
		}
		.ProviderChargeID = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *PaymentCharge) () ( string) {
	if  == nil {
		return
	}
	return .ID
}

// GetProviderChargeID returns value of ProviderChargeID field.
func ( *PaymentCharge) () ( string) {
	if  == nil {
		return
	}
	return .ProviderChargeID
}