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

// StatsGroupTopInviter represents TL type `statsGroupTopInviter#535f779d`.
// Information about an active supergroup inviter
//
// See https://core.telegram.org/constructor/statsGroupTopInviter for reference.
type StatsGroupTopInviter struct {
	// User ID
	UserID int64
	// Number of invitations for statisticsĀ¹ period in consideration
	//
	// Links:
	//  1) https://core.telegram.org/api/stats
	Invitations int
}

// StatsGroupTopInviterTypeID is TL type id of StatsGroupTopInviter.
const StatsGroupTopInviterTypeID = 0x535f779d

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

func ( *StatsGroupTopInviter) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == 0) {
		return false
	}
	if !(.Invitations == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StatsGroupTopInviter from given interface.
func ( *StatsGroupTopInviter) ( interface {
	() ( int64)
	() ( int)
}) {
	.UserID = .()
	.Invitations = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StatsGroupTopInviter) () tdp.Type {
	 := tdp.Type{
		Name: "statsGroupTopInviter",
		ID:   StatsGroupTopInviterTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Invitations",
			SchemaName: "invitations",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StatsGroupTopInviter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsGroupTopInviter#535f779d as nil")
	}
	.PutID(StatsGroupTopInviterTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StatsGroupTopInviter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsGroupTopInviter#535f779d as nil")
	}
	.PutLong(.UserID)
	.PutInt(.Invitations)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StatsGroupTopInviter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode statsGroupTopInviter#535f779d to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode statsGroupTopInviter#535f779d: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode statsGroupTopInviter#535f779d: field invitations: %w", )
		}
		.Invitations = 
	}
	return nil
}

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

// GetInvitations returns value of Invitations field.
func ( *StatsGroupTopInviter) () ( int) {
	if  == nil {
		return
	}
	return .Invitations
}