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

// ToncenterStreamingURL represents TL type `toncenter.streamingUrl#19887601`.
//
// See https://core.telegram.org/constructor/toncenter.streamingUrl for reference.
type ToncenterStreamingURL struct {
	// URL field of ToncenterStreamingURL.
	URL string
	// Expires field of ToncenterStreamingURL.
	Expires int
}

// ToncenterStreamingURLTypeID is TL type id of ToncenterStreamingURL.
const ToncenterStreamingURLTypeID = 0x19887601

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

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

	return true
}

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

// FillFrom fills ToncenterStreamingURL from given interface.
func ( *ToncenterStreamingURL) ( interface {
	() ( string)
	() ( int)
}) {
	.URL = .()
	.Expires = .()
}

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

// TypeName returns name of type in TL schema.
func (*ToncenterStreamingURL) () string {
	return "toncenter.streamingUrl"
}

// TypeInfo returns info about TL type.
func ( *ToncenterStreamingURL) () tdp.Type {
	 := tdp.Type{
		Name: "toncenter.streamingUrl",
		ID:   ToncenterStreamingURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Expires",
			SchemaName: "expires",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ToncenterStreamingURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode toncenter.streamingUrl#19887601 as nil")
	}
	.PutID(ToncenterStreamingURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ToncenterStreamingURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode toncenter.streamingUrl#19887601 as nil")
	}
	.PutString(.URL)
	.PutInt(.Expires)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ToncenterStreamingURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode toncenter.streamingUrl#19887601 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode toncenter.streamingUrl#19887601: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode toncenter.streamingUrl#19887601: field expires: %w", )
		}
		.Expires = 
	}
	return nil
}

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

// GetExpires returns value of Expires field.
func ( *ToncenterStreamingURL) () ( int) {
	if  == nil {
		return
	}
	return .Expires
}