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

// UserStatusEmpty represents TL type `userStatusEmpty#9d05049`.
// User status has not been set yet.
//
// See https://core.telegram.org/constructor/userStatusEmpty for reference.
type UserStatusEmpty struct {
}

// UserStatusEmptyTypeID is TL type id of UserStatusEmpty.
const UserStatusEmptyTypeID = 0x9d05049

// construct implements constructor of UserStatusClass.
func ( UserStatusEmpty) () UserStatusClass { return & }

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

	_ UserStatusClass = &UserStatusEmpty{}
)

func ( *UserStatusEmpty) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *UserStatusEmpty) () tdp.Type {
	 := tdp.Type{
		Name: "userStatusEmpty",
		ID:   UserStatusEmptyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *UserStatusEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusEmpty#9d05049 as nil")
	}
	.PutID(UserStatusEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserStatusEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusEmpty#9d05049 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *UserStatusEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userStatusEmpty#9d05049 to nil")
	}
	return nil
}

// UserStatusOnline represents TL type `userStatusOnline#edb93949`.
// Online status of the user.
//
// See https://core.telegram.org/constructor/userStatusOnline for reference.
type UserStatusOnline struct {
	// Time to expiration of the current online status
	Expires int
}

// UserStatusOnlineTypeID is TL type id of UserStatusOnline.
const UserStatusOnlineTypeID = 0xedb93949

// construct implements constructor of UserStatusClass.
func ( UserStatusOnline) () UserStatusClass { return & }

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

	_ UserStatusClass = &UserStatusOnline{}
)

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

	return true
}

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

// FillFrom fills UserStatusOnline from given interface.
func ( *UserStatusOnline) ( interface {
	() ( int)
}) {
	.Expires = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *UserStatusOnline) () tdp.Type {
	 := tdp.Type{
		Name: "userStatusOnline",
		ID:   UserStatusOnlineTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Expires",
			SchemaName: "expires",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UserStatusOnline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusOnline#edb93949 as nil")
	}
	.PutID(UserStatusOnlineTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserStatusOnline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusOnline#edb93949 as nil")
	}
	.PutInt(.Expires)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *UserStatusOnline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userStatusOnline#edb93949 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode userStatusOnline#edb93949: field expires: %w", )
		}
		.Expires = 
	}
	return nil
}

// GetExpires returns value of Expires field.
func ( *UserStatusOnline) () ( int) {
	if  == nil {
		return
	}
	return .Expires
}

// UserStatusOffline represents TL type `userStatusOffline#8c703f`.
// The user's offline status.
//
// See https://core.telegram.org/constructor/userStatusOffline for reference.
type UserStatusOffline struct {
	// Time the user was last seen online
	WasOnline int
}

// UserStatusOfflineTypeID is TL type id of UserStatusOffline.
const UserStatusOfflineTypeID = 0x8c703f

// construct implements constructor of UserStatusClass.
func ( UserStatusOffline) () UserStatusClass { return & }

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

	_ UserStatusClass = &UserStatusOffline{}
)

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

	return true
}

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

// FillFrom fills UserStatusOffline from given interface.
func ( *UserStatusOffline) ( interface {
	() ( int)
}) {
	.WasOnline = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *UserStatusOffline) () tdp.Type {
	 := tdp.Type{
		Name: "userStatusOffline",
		ID:   UserStatusOfflineTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "WasOnline",
			SchemaName: "was_online",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UserStatusOffline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusOffline#8c703f as nil")
	}
	.PutID(UserStatusOfflineTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserStatusOffline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusOffline#8c703f as nil")
	}
	.PutInt(.WasOnline)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *UserStatusOffline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userStatusOffline#8c703f to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode userStatusOffline#8c703f: field was_online: %w", )
		}
		.WasOnline = 
	}
	return nil
}

// GetWasOnline returns value of WasOnline field.
func ( *UserStatusOffline) () ( int) {
	if  == nil {
		return
	}
	return .WasOnline
}

// UserStatusRecently represents TL type `userStatusRecently#7b197dc8`.
// Online status: last seen recently
//
// See https://core.telegram.org/constructor/userStatusRecently for reference.
type UserStatusRecently struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, the exact user status of this user is actually available to us, but to view it
	// we must first purchase a Premium¹ subscription, or allow this user to see our exact
	// last online status. See here »² for more info.
	//
	// Links:
	//  1) https://core.telegram.org/api/premium
	//  2) https://core.telegram.org/constructor/privacyKeyStatusTimestamp
	ByMe bool
}

// UserStatusRecentlyTypeID is TL type id of UserStatusRecently.
const UserStatusRecentlyTypeID = 0x7b197dc8

// construct implements constructor of UserStatusClass.
func ( UserStatusRecently) () UserStatusClass { return & }

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

	_ UserStatusClass = &UserStatusRecently{}
)

func ( *UserStatusRecently) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ByMe == false) {
		return false
	}

	return true
}

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

// FillFrom fills UserStatusRecently from given interface.
func ( *UserStatusRecently) ( interface {
	() ( bool)
}) {
	.ByMe = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *UserStatusRecently) () tdp.Type {
	 := tdp.Type{
		Name: "userStatusRecently",
		ID:   UserStatusRecentlyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ByMe",
			SchemaName: "by_me",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *UserStatusRecently) () {
	if !(.ByMe == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *UserStatusRecently) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusRecently#7b197dc8 as nil")
	}
	.PutID(UserStatusRecentlyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserStatusRecently) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusRecently#7b197dc8 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode userStatusRecently#7b197dc8: field flags: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *UserStatusRecently) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userStatusRecently#7b197dc8 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode userStatusRecently#7b197dc8: field flags: %w", )
		}
	}
	.ByMe = .Flags.Has(0)
	return nil
}

// SetByMe sets value of ByMe conditional field.
func ( *UserStatusRecently) ( bool) {
	if  {
		.Flags.Set(0)
		.ByMe = true
	} else {
		.Flags.Unset(0)
		.ByMe = false
	}
}

// GetByMe returns value of ByMe conditional field.
func ( *UserStatusRecently) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// UserStatusLastWeek represents TL type `userStatusLastWeek#541a1d1a`.
// Online status: last seen last week
//
// See https://core.telegram.org/constructor/userStatusLastWeek for reference.
type UserStatusLastWeek struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, the exact user status of this user is actually available to us, but to view it
	// we must first purchase a Premium¹ subscription, or allow this user to see our exact
	// last online status. See here »² for more info.
	//
	// Links:
	//  1) https://core.telegram.org/api/premium
	//  2) https://core.telegram.org/constructor/privacyKeyStatusTimestamp
	ByMe bool
}

// UserStatusLastWeekTypeID is TL type id of UserStatusLastWeek.
const UserStatusLastWeekTypeID = 0x541a1d1a

// construct implements constructor of UserStatusClass.
func ( UserStatusLastWeek) () UserStatusClass { return & }

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

	_ UserStatusClass = &UserStatusLastWeek{}
)

func ( *UserStatusLastWeek) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ByMe == false) {
		return false
	}

	return true
}

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

// FillFrom fills UserStatusLastWeek from given interface.
func ( *UserStatusLastWeek) ( interface {
	() ( bool)
}) {
	.ByMe = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *UserStatusLastWeek) () tdp.Type {
	 := tdp.Type{
		Name: "userStatusLastWeek",
		ID:   UserStatusLastWeekTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ByMe",
			SchemaName: "by_me",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *UserStatusLastWeek) () {
	if !(.ByMe == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *UserStatusLastWeek) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusLastWeek#541a1d1a as nil")
	}
	.PutID(UserStatusLastWeekTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserStatusLastWeek) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusLastWeek#541a1d1a as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode userStatusLastWeek#541a1d1a: field flags: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *UserStatusLastWeek) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userStatusLastWeek#541a1d1a to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode userStatusLastWeek#541a1d1a: field flags: %w", )
		}
	}
	.ByMe = .Flags.Has(0)
	return nil
}

// SetByMe sets value of ByMe conditional field.
func ( *UserStatusLastWeek) ( bool) {
	if  {
		.Flags.Set(0)
		.ByMe = true
	} else {
		.Flags.Unset(0)
		.ByMe = false
	}
}

// GetByMe returns value of ByMe conditional field.
func ( *UserStatusLastWeek) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// UserStatusLastMonth represents TL type `userStatusLastMonth#65899777`.
// Online status: last seen last month
//
// See https://core.telegram.org/constructor/userStatusLastMonth for reference.
type UserStatusLastMonth struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, the exact user status of this user is actually available to us, but to view it
	// we must first purchase a Premium¹ subscription, or allow this user to see our exact
	// last online status. See here »² for more info.
	//
	// Links:
	//  1) https://core.telegram.org/api/premium
	//  2) https://core.telegram.org/constructor/privacyKeyStatusTimestamp
	ByMe bool
}

// UserStatusLastMonthTypeID is TL type id of UserStatusLastMonth.
const UserStatusLastMonthTypeID = 0x65899777

// construct implements constructor of UserStatusClass.
func ( UserStatusLastMonth) () UserStatusClass { return & }

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

	_ UserStatusClass = &UserStatusLastMonth{}
)

func ( *UserStatusLastMonth) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ByMe == false) {
		return false
	}

	return true
}

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

// FillFrom fills UserStatusLastMonth from given interface.
func ( *UserStatusLastMonth) ( interface {
	() ( bool)
}) {
	.ByMe = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *UserStatusLastMonth) () tdp.Type {
	 := tdp.Type{
		Name: "userStatusLastMonth",
		ID:   UserStatusLastMonthTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ByMe",
			SchemaName: "by_me",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *UserStatusLastMonth) () {
	if !(.ByMe == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *UserStatusLastMonth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusLastMonth#65899777 as nil")
	}
	.PutID(UserStatusLastMonthTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UserStatusLastMonth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode userStatusLastMonth#65899777 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode userStatusLastMonth#65899777: field flags: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *UserStatusLastMonth) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode userStatusLastMonth#65899777 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode userStatusLastMonth#65899777: field flags: %w", )
		}
	}
	.ByMe = .Flags.Has(0)
	return nil
}

// SetByMe sets value of ByMe conditional field.
func ( *UserStatusLastMonth) ( bool) {
	if  {
		.Flags.Set(0)
		.ByMe = true
	} else {
		.Flags.Unset(0)
		.ByMe = false
	}
}

// GetByMe returns value of ByMe conditional field.
func ( *UserStatusLastMonth) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// UserStatusClassName is schema name of UserStatusClass.
const UserStatusClassName = "UserStatus"

// UserStatusClass represents UserStatus generic type.
//
// See https://core.telegram.org/type/UserStatus for reference.
//
// Constructors:
//   - [UserStatusEmpty]
//   - [UserStatusOnline]
//   - [UserStatusOffline]
//   - [UserStatusRecently]
//   - [UserStatusLastWeek]
//   - [UserStatusLastMonth]
//
// Example:
//
//	g, err := tg.DecodeUserStatus(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.UserStatusEmpty: // userStatusEmpty#9d05049
//	case *tg.UserStatusOnline: // userStatusOnline#edb93949
//	case *tg.UserStatusOffline: // userStatusOffline#8c703f
//	case *tg.UserStatusRecently: // userStatusRecently#7b197dc8
//	case *tg.UserStatusLastWeek: // userStatusLastWeek#541a1d1a
//	case *tg.UserStatusLastMonth: // userStatusLastMonth#65899777
//	default: panic(v)
//	}
type UserStatusClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() UserStatusClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeUserStatus implements binary de-serialization for UserStatusClass.
func ( *bin.Buffer) (UserStatusClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case UserStatusEmptyTypeID:
		// Decoding userStatusEmpty#9d05049.
		 := UserStatusEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserStatusClass: %w", )
		}
		return &, nil
	case UserStatusOnlineTypeID:
		// Decoding userStatusOnline#edb93949.
		 := UserStatusOnline{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserStatusClass: %w", )
		}
		return &, nil
	case UserStatusOfflineTypeID:
		// Decoding userStatusOffline#8c703f.
		 := UserStatusOffline{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserStatusClass: %w", )
		}
		return &, nil
	case UserStatusRecentlyTypeID:
		// Decoding userStatusRecently#7b197dc8.
		 := UserStatusRecently{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserStatusClass: %w", )
		}
		return &, nil
	case UserStatusLastWeekTypeID:
		// Decoding userStatusLastWeek#541a1d1a.
		 := UserStatusLastWeek{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserStatusClass: %w", )
		}
		return &, nil
	case UserStatusLastMonthTypeID:
		// Decoding userStatusLastMonth#65899777.
		 := UserStatusLastMonth{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode UserStatusClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode UserStatusClass: %w", bin.NewUnexpectedID())
	}
}

// UserStatus boxes the UserStatusClass providing a helper.
type UserStatusBox struct {
	UserStatus UserStatusClass
}

// Decode implements bin.Decoder for UserStatusBox.
func ( *UserStatusBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode UserStatusBox to nil")
	}
	,  := DecodeUserStatus()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.UserStatus = 
	return nil
}

// Encode implements bin.Encode for UserStatusBox.
func ( *UserStatusBox) ( *bin.Buffer) error {
	if  == nil || .UserStatus == nil {
		return fmt.Errorf("unable to encode UserStatusClass as nil")
	}
	return .UserStatus.Encode()
}