// Code generated by gotdgen, DO NOT EDIT.

package mt

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

// HTTPWaitRequest represents TL type `http_wait#9299359f`.
type HTTPWaitRequest struct {
	// MaxDelay field of HTTPWaitRequest.
	MaxDelay int
	// WaitAfter field of HTTPWaitRequest.
	WaitAfter int
	// MaxWait field of HTTPWaitRequest.
	MaxWait int
}

// HTTPWaitRequestTypeID is TL type id of HTTPWaitRequest.
const HTTPWaitRequestTypeID = 0x9299359f

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

func ( *HTTPWaitRequest) () bool {
	if  == nil {
		return true
	}
	if !(.MaxDelay == 0) {
		return false
	}
	if !(.WaitAfter == 0) {
		return false
	}
	if !(.MaxWait == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *HTTPWaitRequest) () tdp.Type {
	 := tdp.Type{
		Name: "http_wait",
		ID:   HTTPWaitRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MaxDelay",
			SchemaName: "max_delay",
		},
		{
			Name:       "WaitAfter",
			SchemaName: "wait_after",
		},
		{
			Name:       "MaxWait",
			SchemaName: "max_wait",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HTTPWaitRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode http_wait#9299359f as nil")
	}
	.PutID(HTTPWaitRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HTTPWaitRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode http_wait#9299359f as nil")
	}
	.PutInt(.MaxDelay)
	.PutInt(.WaitAfter)
	.PutInt(.MaxWait)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *HTTPWaitRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode http_wait#9299359f to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode http_wait#9299359f: field max_delay: %w", )
		}
		.MaxDelay = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode http_wait#9299359f: field wait_after: %w", )
		}
		.WaitAfter = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode http_wait#9299359f: field max_wait: %w", )
		}
		.MaxWait = 
	}
	return nil
}

// GetMaxDelay returns value of MaxDelay field.
func ( *HTTPWaitRequest) () ( int) {
	if  == nil {
		return
	}
	return .MaxDelay
}

// GetWaitAfter returns value of WaitAfter field.
func ( *HTTPWaitRequest) () ( int) {
	if  == nil {
		return
	}
	return .WaitAfter
}

// GetMaxWait returns value of MaxWait field.
func ( *HTTPWaitRequest) () ( int) {
	if  == nil {
		return
	}
	return .MaxWait
}