//-*-c-*-
//=============================================================================
//
// Copyright (c) XXXX-XXXX
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//=============================================================================

#ifndef RTLIB_COMMON_RT_API_H
#define RTLIB_COMMON_RT_API_H

//! @brief rt_api.h
//! Define API prototypes for both compiler-generated and runtime functions

#include "common.h"
#include "tensor.h"

#ifdef __cplusplus
extern "C" {
#endif

//! @brief Initialize FHE context
//! implemented in vendor library
void Prepare_context();

//! @brief Finalize FHE context
//! implemented in vendor library
void Finalize_context();

//! @brief Prepare input for FHE kernel program
//! implemented in vendor library
void Prepare_input(TENSOR* input, const char* name);

//! @brief Handle output from FHE kernel program
//! implemented in vendor library
double* Handle_output(const char* name);

//! @brief Generated CKKS context param by fhe-cmplr
//! generated by fhe-cmplr
CKKS_PARAMS* Get_context_params();

//! @brief Get seperated weight data file info
//! generated by fhe-cmplr
RT_DATA_INFO* Get_rt_data_info();

//! @brief Return number of input parameters
//! generated by fhe-cmplr
int Get_input_count();

//! @brief Return number of output parameters
//! generated by fhe-cmplr
int Get_output_count();

//! @brief Return scheme to guide pre encoding from tensor to ciphertext
//! generated by fhe-cmplr
DATA_SCHEME* Get_encode_scheme(int idx);

//! @brief Return scheme to guide post decoding from ciphertext to tensor
//! generated by fhe-cmplr
DATA_SCHEME* Get_decode_scheme(int idx);

//! @brief main graph from FHE compiler
//! generated by fhe-cmplr
bool Main_graph();

//! @brief call Main_graph() in FHE compiler
//! implemented in rt_lib.c
void Run_main_graph();

#ifdef __cplusplus
}
#endif

#endif  // RTLIB_COMMON_RT_API_H
