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

// MessagesRequestChatJoinWebViewRequest represents TL type `messages.requestChatJoinWebView#ba9ee679`.
//
// See https://core.telegram.org/method/messages.requestChatJoinWebView for reference.
type MessagesRequestChatJoinWebViewRequest struct {
	// Flags field of MessagesRequestChatJoinWebViewRequest.
	Flags bin.Fields
	// QueryID field of MessagesRequestChatJoinWebViewRequest.
	QueryID int64
	// ThemeParams field of MessagesRequestChatJoinWebViewRequest.
	//
	// Use SetThemeParams and GetThemeParams helpers.
	ThemeParams DataJSON
	// Platform field of MessagesRequestChatJoinWebViewRequest.
	Platform string
}

// MessagesRequestChatJoinWebViewRequestTypeID is TL type id of MessagesRequestChatJoinWebViewRequest.
const MessagesRequestChatJoinWebViewRequestTypeID = 0xba9ee679

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

func ( *MessagesRequestChatJoinWebViewRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.QueryID == 0) {
		return false
	}
	if !(.ThemeParams.Zero()) {
		return false
	}
	if !(.Platform == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesRequestChatJoinWebViewRequest from given interface.
func ( *MessagesRequestChatJoinWebViewRequest) ( interface {
	() ( int64)
	() ( DataJSON,  bool)
	() ( string)
}) {
	.QueryID = .()
	if ,  := .();  {
		.ThemeParams = 
	}

	.Platform = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesRequestChatJoinWebViewRequest) () string {
	return "messages.requestChatJoinWebView"
}

// TypeInfo returns info about TL type.
func ( *MessagesRequestChatJoinWebViewRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.requestChatJoinWebView",
		ID:   MessagesRequestChatJoinWebViewRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "QueryID",
			SchemaName: "query_id",
		},
		{
			Name:       "ThemeParams",
			SchemaName: "theme_params",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Platform",
			SchemaName: "platform",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesRequestChatJoinWebViewRequest) () {
	if !(.ThemeParams.Zero()) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesRequestChatJoinWebViewRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.requestChatJoinWebView#ba9ee679 as nil")
	}
	.PutID(MessagesRequestChatJoinWebViewRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesRequestChatJoinWebViewRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.requestChatJoinWebView#ba9ee679 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.requestChatJoinWebView#ba9ee679: field flags: %w", )
	}
	.PutLong(.QueryID)
	if .Flags.Has(0) {
		if  := .ThemeParams.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.requestChatJoinWebView#ba9ee679: field theme_params: %w", )
		}
	}
	.PutString(.Platform)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesRequestChatJoinWebViewRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.requestChatJoinWebView#ba9ee679 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.requestChatJoinWebView#ba9ee679: field flags: %w", )
		}
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.requestChatJoinWebView#ba9ee679: field query_id: %w", )
		}
		.QueryID = 
	}
	if .Flags.Has(0) {
		if  := .ThemeParams.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.requestChatJoinWebView#ba9ee679: field theme_params: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.requestChatJoinWebView#ba9ee679: field platform: %w", )
		}
		.Platform = 
	}
	return nil
}

// GetQueryID returns value of QueryID field.
func ( *MessagesRequestChatJoinWebViewRequest) () ( int64) {
	if  == nil {
		return
	}
	return .QueryID
}

// SetThemeParams sets value of ThemeParams conditional field.
func ( *MessagesRequestChatJoinWebViewRequest) ( DataJSON) {
	.Flags.Set(0)
	.ThemeParams = 
}

// GetThemeParams returns value of ThemeParams conditional field and
// boolean which is true if field was set.
func ( *MessagesRequestChatJoinWebViewRequest) () ( DataJSON,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .ThemeParams, true
}

// GetPlatform returns value of Platform field.
func ( *MessagesRequestChatJoinWebViewRequest) () ( string) {
	if  == nil {
		return
	}
	return .Platform
}

// MessagesRequestChatJoinWebView invokes method messages.requestChatJoinWebView#ba9ee679 returning error if any.
//
// See https://core.telegram.org/method/messages.requestChatJoinWebView for reference.
func ( *Client) ( context.Context,  *MessagesRequestChatJoinWebViewRequest) (*WebViewResultURL, error) {
	var  WebViewResultURL

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