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

// ChatOnlines represents TL type `chatOnlines#f041e250`.
// Number of online users in a chat
//
// See https://core.telegram.org/constructor/chatOnlines for reference.
type ChatOnlines struct {
	// Number of online users
	Onlines int
}

// ChatOnlinesTypeID is TL type id of ChatOnlines.
const ChatOnlinesTypeID = 0xf041e250

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

func ( *ChatOnlines) () bool {
	if  == nil {
		return true
	}
	if !(.Onlines == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ChatOnlines from given interface.
func ( *ChatOnlines) ( interface {
	() ( int)
}) {
	.Onlines = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChatOnlines) () tdp.Type {
	 := tdp.Type{
		Name: "chatOnlines",
		ID:   ChatOnlinesTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Onlines",
			SchemaName: "onlines",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChatOnlines) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatOnlines#f041e250 as nil")
	}
	.PutID(ChatOnlinesTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChatOnlines) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatOnlines#f041e250 as nil")
	}
	.PutInt(.Onlines)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChatOnlines) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatOnlines#f041e250 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode chatOnlines#f041e250: field onlines: %w", )
		}
		.Onlines = 
	}
	return nil
}

// GetOnlines returns value of Onlines field.
func ( *ChatOnlines) () ( int) {
	if  == nil {
		return
	}
	return .Onlines
}