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

// InvokeWithTakeoutRequest represents TL type `invokeWithTakeout#aca9fd2e`.
// Invoke a method within a takeout session, see here » for more info¹.
//
// Links:
//  1. https://core.telegram.org/api/takeout
//
// See https://core.telegram.org/constructor/invokeWithTakeout for reference.
type InvokeWithTakeoutRequest struct {
	// Takeout session ID »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/takeout
	TakeoutID int64
	// Query
	Query bin.Object
}

// InvokeWithTakeoutRequestTypeID is TL type id of InvokeWithTakeoutRequest.
const InvokeWithTakeoutRequestTypeID = 0xaca9fd2e

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

func ( *InvokeWithTakeoutRequest) () bool {
	if  == nil {
		return true
	}
	if !(.TakeoutID == 0) {
		return false
	}
	if !(.Query == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InvokeWithTakeoutRequest from given interface.
func ( *InvokeWithTakeoutRequest) ( interface {
	() ( int64)
	() ( bin.Object)
}) {
	.TakeoutID = .()
	.Query = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InvokeWithTakeoutRequest) () tdp.Type {
	 := tdp.Type{
		Name: "invokeWithTakeout",
		ID:   InvokeWithTakeoutRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "TakeoutID",
			SchemaName: "takeout_id",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InvokeWithTakeoutRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeWithTakeout#aca9fd2e as nil")
	}
	.PutID(InvokeWithTakeoutRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InvokeWithTakeoutRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeWithTakeout#aca9fd2e as nil")
	}
	.PutLong(.TakeoutID)
	if  := .Query.Encode();  != nil {
		return fmt.Errorf("unable to encode invokeWithTakeout#aca9fd2e: field query: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InvokeWithTakeoutRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeWithTakeout#aca9fd2e to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode invokeWithTakeout#aca9fd2e: field takeout_id: %w", )
		}
		.TakeoutID = 
	}
	{
		if  := .Query.Decode();  != nil {
			return fmt.Errorf("unable to decode invokeWithTakeout#aca9fd2e: field query: %w", )
		}
	}
	return nil
}

// GetTakeoutID returns value of TakeoutID field.
func ( *InvokeWithTakeoutRequest) () ( int64) {
	if  == nil {
		return
	}
	return .TakeoutID
}

// GetQuery returns value of Query field.
func ( *InvokeWithTakeoutRequest) () ( bin.Object) {
	if  == nil {
		return
	}
	return .Query
}