/**
 * @file helper.h
 * @author Jan Holáň, xholan11 (xholan11@vutbr.cz)
 * @brief translated with gcc version 12.2.1
 * @version 0.1
 * @date 2023-05-01
 *
 * @copyright Copyright (c) 2023
 *
 */

#ifndef _HELPER_H_
#define _HELPER_H_

#include <nlohmann/json.hpp>
#include <string>
#include <fstream>
#include <iostream>
#include "WarehousePickingOpt.h"

using namespace std;
using json = nlohmann::json;

/// @brief function for creating json object from file given as path
/// @param path to file .json
/// @return json object
json readJsonFromFile(string path);

class OItem;
/// @brief function for converting OItem to json
void to_json(json &j, const OItem &it);

class CartOItem;
/// @brief function for converting CartOItem to json
/// @param j
/// @param coi
void to_json(json &j, const CartOItem &coi);

class BoxItem;
/// @brief function for converting BoxItem to json
/// @param j
/// @param bi
void to_json(json &j, const BoxItem &bi);

/// @brief computation of the shortest (air) path between two points in warehouse
/// @param first_addr first address as first point of triangle
/// @param second_addr second address as second point of triangle
/// @return floating number as the lenght of the hypothenuse
float euclidean_distance(SECTOR_ADDR_T first_addr, SECTOR_ADDR_T second_addr);

/// @brief computation of the distance between two points in euclidean space, meaning right-angle space
/// @param first_addr first address as first point of triangle
/// @param second_addr second address as second point of triangle
/// @return floating number as the lenght of the right-angle distance
float orthogonal_distance(SECTOR_ADDR_T first_addr, SECTOR_ADDR_T second_addr);

/// @brief factorial computation with memory of previously computed factorials
/// @param num number to be processed
/// @return factorial
int factorial(int num);

#endif