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

// WalletOwnershipProof represents TL type `walletOwnershipProof#60bccb0d`.
//
// See https://core.telegram.org/constructor/walletOwnershipProof for reference.
type WalletOwnershipProof struct {
	// Timestamp field of WalletOwnershipProof.
	Timestamp int
	// Signature field of WalletOwnershipProof.
	Signature []byte
}

// WalletOwnershipProofTypeID is TL type id of WalletOwnershipProof.
const WalletOwnershipProofTypeID = 0x60bccb0d

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

func ( *WalletOwnershipProof) () bool {
	if  == nil {
		return true
	}
	if !(.Timestamp == 0) {
		return false
	}
	if !(.Signature == nil) {
		return false
	}

	return true
}

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

// FillFrom fills WalletOwnershipProof from given interface.
func ( *WalletOwnershipProof) ( interface {
	() ( int)
	() ( []byte)
}) {
	.Timestamp = .()
	.Signature = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *WalletOwnershipProof) () tdp.Type {
	 := tdp.Type{
		Name: "walletOwnershipProof",
		ID:   WalletOwnershipProofTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Timestamp",
			SchemaName: "timestamp",
		},
		{
			Name:       "Signature",
			SchemaName: "signature",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *WalletOwnershipProof) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode walletOwnershipProof#60bccb0d as nil")
	}
	.PutID(WalletOwnershipProofTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletOwnershipProof) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode walletOwnershipProof#60bccb0d as nil")
	}
	.PutInt(.Timestamp)
	.PutBytes(.Signature)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WalletOwnershipProof) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode walletOwnershipProof#60bccb0d to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode walletOwnershipProof#60bccb0d: field timestamp: %w", )
		}
		.Timestamp = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode walletOwnershipProof#60bccb0d: field signature: %w", )
		}
		.Signature = 
	}
	return nil
}

// GetTimestamp returns value of Timestamp field.
func ( *WalletOwnershipProof) () ( int) {
	if  == nil {
		return
	}
	return .Timestamp
}

// GetSignature returns value of Signature field.
func ( *WalletOwnershipProof) () ( []byte) {
	if  == nil {
		return
	}
	return .Signature
}