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

// WalletProofChallenge represents TL type `wallet.proofChallenge#99e41707`.
//
// See https://core.telegram.org/constructor/wallet.proofChallenge for reference.
type WalletProofChallenge struct {
	// Payload field of WalletProofChallenge.
	Payload string
	// Expires field of WalletProofChallenge.
	Expires int
	// Domain field of WalletProofChallenge.
	Domain string
}

// WalletProofChallengeTypeID is TL type id of WalletProofChallenge.
const WalletProofChallengeTypeID = 0x99e41707

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

func ( *WalletProofChallenge) () bool {
	if  == nil {
		return true
	}
	if !(.Payload == "") {
		return false
	}
	if !(.Expires == 0) {
		return false
	}
	if !(.Domain == "") {
		return false
	}

	return true
}

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

// FillFrom fills WalletProofChallenge from given interface.
func ( *WalletProofChallenge) ( interface {
	() ( string)
	() ( int)
	() ( string)
}) {
	.Payload = .()
	.Expires = .()
	.Domain = .()
}

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

// TypeName returns name of type in TL schema.
func (*WalletProofChallenge) () string {
	return "wallet.proofChallenge"
}

// TypeInfo returns info about TL type.
func ( *WalletProofChallenge) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.proofChallenge",
		ID:   WalletProofChallengeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Payload",
			SchemaName: "payload",
		},
		{
			Name:       "Expires",
			SchemaName: "expires",
		},
		{
			Name:       "Domain",
			SchemaName: "domain",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *WalletProofChallenge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.proofChallenge#99e41707 as nil")
	}
	.PutID(WalletProofChallengeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletProofChallenge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.proofChallenge#99e41707 as nil")
	}
	.PutString(.Payload)
	.PutInt(.Expires)
	.PutString(.Domain)
	return nil
}

// Decode implements bin.Decoder.
func ( *WalletProofChallenge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.proofChallenge#99e41707 to nil")
	}
	if  := .ConsumeID(WalletProofChallengeTypeID);  != nil {
		return fmt.Errorf("unable to decode wallet.proofChallenge#99e41707: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *WalletProofChallenge) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.proofChallenge#99e41707 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.proofChallenge#99e41707: field payload: %w", )
		}
		.Payload = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.proofChallenge#99e41707: field expires: %w", )
		}
		.Expires = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.proofChallenge#99e41707: field domain: %w", )
		}
		.Domain = 
	}
	return nil
}

// GetPayload returns value of Payload field.
func ( *WalletProofChallenge) () ( string) {
	if  == nil {
		return
	}
	return .Payload
}

// GetExpires returns value of Expires field.
func ( *WalletProofChallenge) () ( int) {
	if  == nil {
		return
	}
	return .Expires
}

// GetDomain returns value of Domain field.
func ( *WalletProofChallenge) () ( string) {
	if  == nil {
		return
	}
	return .Domain
}