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

// WebViewResultURL represents TL type `webViewResultUrl#c14557c`.
// Contains the webview URL with appropriate theme and user info parameters added
//
// See https://core.telegram.org/constructor/webViewResultUrl for reference.
type WebViewResultURL struct {
	// Webview session ID
	QueryID int64
	// Webview URL to open
	URL string
}

// WebViewResultURLTypeID is TL type id of WebViewResultURL.
const WebViewResultURLTypeID = 0xc14557c

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

func ( *WebViewResultURL) () bool {
	if  == nil {
		return true
	}
	if !(.QueryID == 0) {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills WebViewResultURL from given interface.
func ( *WebViewResultURL) ( interface {
	() ( int64)
	() ( string)
}) {
	.QueryID = .()
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *WebViewResultURL) () tdp.Type {
	 := tdp.Type{
		Name: "webViewResultUrl",
		ID:   WebViewResultURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "QueryID",
			SchemaName: "query_id",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *WebViewResultURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode webViewResultUrl#c14557c as nil")
	}
	.PutID(WebViewResultURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WebViewResultURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode webViewResultUrl#c14557c as nil")
	}
	.PutLong(.QueryID)
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WebViewResultURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode webViewResultUrl#c14557c to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode webViewResultUrl#c14557c: field query_id: %w", )
		}
		.QueryID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode webViewResultUrl#c14557c: field url: %w", )
		}
		.URL = 
	}
	return nil
}

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

// GetURL returns value of URL field.
func ( *WebViewResultURL) () ( string) {
	if  == nil {
		return
	}
	return .URL
}