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

// StatsPollStats represents TL type `stats.pollStats#2999beed`.
//
// See https://core.telegram.org/constructor/stats.pollStats for reference.
type StatsPollStats struct {
	// VotesGraph field of StatsPollStats.
	VotesGraph StatsGraphClass
}

// StatsPollStatsTypeID is TL type id of StatsPollStats.
const StatsPollStatsTypeID = 0x2999beed

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

func ( *StatsPollStats) () bool {
	if  == nil {
		return true
	}
	if !(.VotesGraph == nil) {
		return false
	}

	return true
}

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

// FillFrom fills StatsPollStats from given interface.
func ( *StatsPollStats) ( interface {
	() ( StatsGraphClass)
}) {
	.VotesGraph = .()
}

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

// TypeName returns name of type in TL schema.
func (*StatsPollStats) () string {
	return "stats.pollStats"
}

// TypeInfo returns info about TL type.
func ( *StatsPollStats) () tdp.Type {
	 := tdp.Type{
		Name: "stats.pollStats",
		ID:   StatsPollStatsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "VotesGraph",
			SchemaName: "votes_graph",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StatsPollStats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stats.pollStats#2999beed as nil")
	}
	.PutID(StatsPollStatsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StatsPollStats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stats.pollStats#2999beed as nil")
	}
	if .VotesGraph == nil {
		return fmt.Errorf("unable to encode stats.pollStats#2999beed: field votes_graph is nil")
	}
	if  := .VotesGraph.Encode();  != nil {
		return fmt.Errorf("unable to encode stats.pollStats#2999beed: field votes_graph: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *StatsPollStats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stats.pollStats#2999beed to nil")
	}
	if  := .ConsumeID(StatsPollStatsTypeID);  != nil {
		return fmt.Errorf("unable to decode stats.pollStats#2999beed: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *StatsPollStats) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stats.pollStats#2999beed to nil")
	}
	{
		,  := DecodeStatsGraph()
		if  != nil {
			return fmt.Errorf("unable to decode stats.pollStats#2999beed: field votes_graph: %w", )
		}
		.VotesGraph = 
	}
	return nil
}

// GetVotesGraph returns value of VotesGraph field.
func ( *StatsPollStats) () ( StatsGraphClass) {
	if  == nil {
		return
	}
	return .VotesGraph
}