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

// AuthExportAuthorizationRequest represents TL type `auth.exportAuthorization#e5bfffcd`.
// Returns data for copying authorization to another data-center.
//
// See https://core.telegram.org/method/auth.exportAuthorization for reference.
type AuthExportAuthorizationRequest struct {
	// Number of a target data-center
	DCID int
}

// AuthExportAuthorizationRequestTypeID is TL type id of AuthExportAuthorizationRequest.
const AuthExportAuthorizationRequestTypeID = 0xe5bfffcd

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

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

	return true
}

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

// FillFrom fills AuthExportAuthorizationRequest from given interface.
func ( *AuthExportAuthorizationRequest) ( interface {
	() ( int)
}) {
	.DCID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AuthExportAuthorizationRequest) () tdp.Type {
	 := tdp.Type{
		Name: "auth.exportAuthorization",
		ID:   AuthExportAuthorizationRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "DCID",
			SchemaName: "dc_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuthExportAuthorizationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.exportAuthorization#e5bfffcd as nil")
	}
	.PutID(AuthExportAuthorizationRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthExportAuthorizationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.exportAuthorization#e5bfffcd as nil")
	}
	.PutInt(.DCID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AuthExportAuthorizationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.exportAuthorization#e5bfffcd to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode auth.exportAuthorization#e5bfffcd: field dc_id: %w", )
		}
		.DCID = 
	}
	return nil
}

// GetDCID returns value of DCID field.
func ( *AuthExportAuthorizationRequest) () ( int) {
	if  == nil {
		return
	}
	return .DCID
}

// AuthExportAuthorization invokes method auth.exportAuthorization#e5bfffcd returning error if any.
// Returns data for copying authorization to another data-center.
//
// Possible errors:
//
//	400 DC_ID_INVALID: The provided DC ID is invalid.
//
// See https://core.telegram.org/method/auth.exportAuthorization for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  int) (*AuthExportedAuthorization, error) {
	var  AuthExportedAuthorization

	 := &AuthExportAuthorizationRequest{
		DCID: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}