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

// StatsURL represents TL type `statsURL#47a971e0`.
// URL with chat statistics
//
// See https://core.telegram.org/constructor/statsURL for reference.
type StatsURL struct {
	// Chat statistics
	URL string
}

// StatsURLTypeID is TL type id of StatsURL.
const StatsURLTypeID = 0x47a971e0

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *StatsURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsURL#47a971e0 as nil")
	}
	.PutID(StatsURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StatsURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsURL#47a971e0 as nil")
	}
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StatsURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode statsURL#47a971e0 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode statsURL#47a971e0: field url: %w", )
		}
		.URL = 
	}
	return nil
}

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