/**
 * @file   TigerFingerprintIdTable.h
 * @brief  Handling of real FID (32-byte array)
 *         and mapping them to integer counters
 * @author Konstyantyn Volobuyev (k.volobuyev@samsung.com)
 * @date   Oct 02, 2017
 *
 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Created in Samsung Ukraine R&D Center (SRK) under a contract between
 * LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine)
 * and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 **/

#ifndef TIGERFINGERPRINTIDTABLE_H
#define TIGERFINGERPRINTIDTABLE_H

#include "TzwCommon.h"

/**
 * @brief Loads fingerprint table from SFS storage
 * @return status of the operation, e.g. TEE_SUCCESS on success
 */
TEE_Result tigerFPTableLoad();

/**
 * @brief Saves fingerprint table to SFS storage
 * @return status of the operation, e.g. TEE_SUCCESS on success
 */
TEE_Result tigerFPTableSave();

/**
 * @brief Inserts FID index to the table
 * @param[in] realFid - Real FID from fingerprint daemon
 * @param[in] realFidSize - Real FID size
 * @param[in] entryIndex - Entry FID
 * @param[in] soterFid - SOTER FID
 * @return status of the operation, e.g. TEE_SUCCESS on success
 */
TEE_Result tigerFPTableInsert(const uint8_t* const realFid,
                              const uint32_t realFidSize,
                              const uint32_t entryIndex,
                              const uint32_t soterFid);

/**
 * @brief Gets FID index from the table
 * @param[in] realFid - Real FID from fingerprint daemon
 * @param[in] realFidSize - Real FID size
 * @param[in] entryIndex - FID index from fingerprint daemon
 * @param[out] soterFid - SOTER FID
 * @return status of the operation, e.g. TEE_SUCCESS on success
 */
TEE_Result tigerFPTableGetUniqueId(const uint8_t* const realFid,
                                   const uint32_t realFidSize,
                                   const uint32_t entryIndex,
                                   uint32_t* soterFid);

/**
 * @brief init Fid table (if table not exist, then create it)
 */
void initFPTable();

#endif // TIGERFINGERPRINTIDTABLE_H
