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

// AuthExportedAuthorization represents TL type `auth.exportedAuthorization#b434e2b8`.
// Data for copying of authorization between data centers.
//
// See https://core.telegram.org/constructor/auth.exportedAuthorization for reference.
type AuthExportedAuthorization struct {
	// current user identifier
	ID int64
	// authorizes key
	Bytes []byte
}

// AuthExportedAuthorizationTypeID is TL type id of AuthExportedAuthorization.
const AuthExportedAuthorizationTypeID = 0xb434e2b8

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

func ( *AuthExportedAuthorization) () bool {
	if  == nil {
		return true
	}
	if !(.ID == 0) {
		return false
	}
	if !(.Bytes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AuthExportedAuthorization from given interface.
func ( *AuthExportedAuthorization) ( interface {
	() ( int64)
	() ( []byte)
}) {
	.ID = .()
	.Bytes = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AuthExportedAuthorization) () tdp.Type {
	 := tdp.Type{
		Name: "auth.exportedAuthorization",
		ID:   AuthExportedAuthorizationTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuthExportedAuthorization) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.exportedAuthorization#b434e2b8 as nil")
	}
	.PutID(AuthExportedAuthorizationTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthExportedAuthorization) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.exportedAuthorization#b434e2b8 as nil")
	}
	.PutLong(.ID)
	.PutBytes(.Bytes)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AuthExportedAuthorization) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.exportedAuthorization#b434e2b8 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode auth.exportedAuthorization#b434e2b8: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode auth.exportedAuthorization#b434e2b8: field bytes: %w", )
		}
		.Bytes = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *AuthExportedAuthorization) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}

// GetBytes returns value of Bytes field.
func ( *AuthExportedAuthorization) () ( []byte) {
	if  == nil {
		return
	}
	return .Bytes
}