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

// WalletTonConnectSubmitResponseRequest represents TL type `wallet.tonConnectSubmitResponse#fac67d3c`.
//
// See https://core.telegram.org/method/wallet.tonConnectSubmitResponse for reference.
type WalletTonConnectSubmitResponseRequest struct {
	// Flags field of WalletTonConnectSubmitResponseRequest.
	Flags bin.Fields
	// SessionID field of WalletTonConnectSubmitResponseRequest.
	SessionID int64
	// MsgID field of WalletTonConnectSubmitResponseRequest.
	MsgID int
	// Body field of WalletTonConnectSubmitResponseRequest.
	Body []byte
	// TraceID field of WalletTonConnectSubmitResponseRequest.
	//
	// Use SetTraceID and GetTraceID helpers.
	TraceID string
}

// WalletTonConnectSubmitResponseRequestTypeID is TL type id of WalletTonConnectSubmitResponseRequest.
const WalletTonConnectSubmitResponseRequestTypeID = 0xfac67d3c

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

func ( *WalletTonConnectSubmitResponseRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.SessionID == 0) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.Body == nil) {
		return false
	}
	if !(.TraceID == "") {
		return false
	}

	return true
}

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

// FillFrom fills WalletTonConnectSubmitResponseRequest from given interface.
func ( *WalletTonConnectSubmitResponseRequest) ( interface {
	() ( int64)
	() ( int)
	() ( []byte)
	() ( string,  bool)
}) {
	.SessionID = .()
	.MsgID = .()
	.Body = .()
	if ,  := .();  {
		.TraceID = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *WalletTonConnectSubmitResponseRequest) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.tonConnectSubmitResponse",
		ID:   WalletTonConnectSubmitResponseRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "SessionID",
			SchemaName: "session_id",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "Body",
			SchemaName: "body",
		},
		{
			Name:       "TraceID",
			SchemaName: "trace_id",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *WalletTonConnectSubmitResponseRequest) () {
	if !(.TraceID == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *WalletTonConnectSubmitResponseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.tonConnectSubmitResponse#fac67d3c as nil")
	}
	.PutID(WalletTonConnectSubmitResponseRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletTonConnectSubmitResponseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.tonConnectSubmitResponse#fac67d3c as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode wallet.tonConnectSubmitResponse#fac67d3c: field flags: %w", )
	}
	.PutLong(.SessionID)
	.PutInt(.MsgID)
	.PutBytes(.Body)
	if .Flags.Has(0) {
		.PutString(.TraceID)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WalletTonConnectSubmitResponseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.tonConnectSubmitResponse#fac67d3c to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectSubmitResponse#fac67d3c: field flags: %w", )
		}
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectSubmitResponse#fac67d3c: field session_id: %w", )
		}
		.SessionID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectSubmitResponse#fac67d3c: field msg_id: %w", )
		}
		.MsgID = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectSubmitResponse#fac67d3c: field body: %w", )
		}
		.Body = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.tonConnectSubmitResponse#fac67d3c: field trace_id: %w", )
		}
		.TraceID = 
	}
	return nil
}

// GetSessionID returns value of SessionID field.
func ( *WalletTonConnectSubmitResponseRequest) () ( int64) {
	if  == nil {
		return
	}
	return .SessionID
}

// GetMsgID returns value of MsgID field.
func ( *WalletTonConnectSubmitResponseRequest) () ( int) {
	if  == nil {
		return
	}
	return .MsgID
}

// GetBody returns value of Body field.
func ( *WalletTonConnectSubmitResponseRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .Body
}

// SetTraceID sets value of TraceID conditional field.
func ( *WalletTonConnectSubmitResponseRequest) ( string) {
	.Flags.Set(0)
	.TraceID = 
}

// GetTraceID returns value of TraceID conditional field and
// boolean which is true if field was set.
func ( *WalletTonConnectSubmitResponseRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .TraceID, true
}

// WalletTonConnectSubmitResponse invokes method wallet.tonConnectSubmitResponse#fac67d3c returning error if any.
//
// See https://core.telegram.org/method/wallet.tonConnectSubmitResponse for reference.
func ( *Client) ( context.Context,  *WalletTonConnectSubmitResponseRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}