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

// StatsGroupTopAdmin represents TL type `statsGroupTopAdmin#d7584c87`.
// Information about an active admin in a supergroup
//
// See https://core.telegram.org/constructor/statsGroupTopAdmin for reference.
type StatsGroupTopAdmin struct {
	// User ID
	UserID int64
	// Number of deleted messages for statisticsĀ¹ period in consideration
	//
	// Links:
	//  1) https://core.telegram.org/api/stats
	Deleted int
	// Number of kicked users for statisticsĀ¹ period in consideration
	//
	// Links:
	//  1) https://core.telegram.org/api/stats
	Kicked int
	// Number of banned users for statisticsĀ¹ period in consideration
	//
	// Links:
	//  1) https://core.telegram.org/api/stats
	Banned int
}

// StatsGroupTopAdminTypeID is TL type id of StatsGroupTopAdmin.
const StatsGroupTopAdminTypeID = 0xd7584c87

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

func ( *StatsGroupTopAdmin) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == 0) {
		return false
	}
	if !(.Deleted == 0) {
		return false
	}
	if !(.Kicked == 0) {
		return false
	}
	if !(.Banned == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StatsGroupTopAdmin from given interface.
func ( *StatsGroupTopAdmin) ( interface {
	() ( int64)
	() ( int)
	() ( int)
	() ( int)
}) {
	.UserID = .()
	.Deleted = .()
	.Kicked = .()
	.Banned = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StatsGroupTopAdmin) () tdp.Type {
	 := tdp.Type{
		Name: "statsGroupTopAdmin",
		ID:   StatsGroupTopAdminTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Deleted",
			SchemaName: "deleted",
		},
		{
			Name:       "Kicked",
			SchemaName: "kicked",
		},
		{
			Name:       "Banned",
			SchemaName: "banned",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StatsGroupTopAdmin) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsGroupTopAdmin#d7584c87 as nil")
	}
	.PutID(StatsGroupTopAdminTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StatsGroupTopAdmin) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsGroupTopAdmin#d7584c87 as nil")
	}
	.PutLong(.UserID)
	.PutInt(.Deleted)
	.PutInt(.Kicked)
	.PutInt(.Banned)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StatsGroupTopAdmin) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode statsGroupTopAdmin#d7584c87 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode statsGroupTopAdmin#d7584c87: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode statsGroupTopAdmin#d7584c87: field deleted: %w", )
		}
		.Deleted = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode statsGroupTopAdmin#d7584c87: field kicked: %w", )
		}
		.Kicked = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode statsGroupTopAdmin#d7584c87: field banned: %w", )
		}
		.Banned = 
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *StatsGroupTopAdmin) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

// GetDeleted returns value of Deleted field.
func ( *StatsGroupTopAdmin) () ( int) {
	if  == nil {
		return
	}
	return .Deleted
}

// GetKicked returns value of Kicked field.
func ( *StatsGroupTopAdmin) () ( int) {
	if  == nil {
		return
	}
	return .Kicked
}

// GetBanned returns value of Banned field.
func ( *StatsGroupTopAdmin) () ( int) {
	if  == nil {
		return
	}
	return .Banned
}