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

// AuthLoggedOut represents TL type `auth.loggedOut#c3a2835f`.
// Future auth token »¹ to be used on subsequent authorizations
//
// Links:
//  1. https://core.telegram.org/api/auth#future-auth-tokens
//
// See https://core.telegram.org/constructor/auth.loggedOut for reference.
type AuthLoggedOut struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Future auth token »¹ to be used on subsequent authorizations
	//
	// Links:
	//  1) https://core.telegram.org/api/auth#future-auth-tokens
	//
	// Use SetFutureAuthToken and GetFutureAuthToken helpers.
	FutureAuthToken []byte
}

// AuthLoggedOutTypeID is TL type id of AuthLoggedOut.
const AuthLoggedOutTypeID = 0xc3a2835f

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

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

	return true
}

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

// FillFrom fills AuthLoggedOut from given interface.
func ( *AuthLoggedOut) ( interface {
	() ( []byte,  bool)
}) {
	if ,  := .();  {
		.FutureAuthToken = 
	}

}

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

// TypeName returns name of type in TL schema.
func (*AuthLoggedOut) () string {
	return "auth.loggedOut"
}

// TypeInfo returns info about TL type.
func ( *AuthLoggedOut) () tdp.Type {
	 := tdp.Type{
		Name: "auth.loggedOut",
		ID:   AuthLoggedOutTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "FutureAuthToken",
			SchemaName: "future_auth_token",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *AuthLoggedOut) () {
	if !(.FutureAuthToken == nil) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *AuthLoggedOut) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.loggedOut#c3a2835f as nil")
	}
	.PutID(AuthLoggedOutTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthLoggedOut) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.loggedOut#c3a2835f as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode auth.loggedOut#c3a2835f: field flags: %w", )
	}
	if .Flags.Has(0) {
		.PutBytes(.FutureAuthToken)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AuthLoggedOut) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.loggedOut#c3a2835f to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode auth.loggedOut#c3a2835f: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode auth.loggedOut#c3a2835f: field future_auth_token: %w", )
		}
		.FutureAuthToken = 
	}
	return nil
}

// SetFutureAuthToken sets value of FutureAuthToken conditional field.
func ( *AuthLoggedOut) ( []byte) {
	.Flags.Set(0)
	.FutureAuthToken = 
}

// GetFutureAuthToken returns value of FutureAuthToken conditional field and
// boolean which is true if field was set.
func ( *AuthLoggedOut) () ( []byte,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .FutureAuthToken, true
}