/**
 * @file customer.cpp
 * @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
 * 
 */

#include "WarehousePickingOpt.h"
#include "bin_packing_solver.h"

Customer::~Customer(){};

void Customer::addOItem(OItem o_item)
{
    // check whether the customers id fits, otherwise don't add it
    this->item_vect.push_back(o_item);
}

void Customer::countTotalWeightAndVolume()
{
    for (auto item : this->item_vect)
    {
        this->total_volume += item.getVolume();
        this->total_weight += item.getWeight();
    }
}

void Customer::decompIntoBoxes(BoxConfiguration &bc, SolverConfiguration &sc)
{
    switch (sc.getBPAlgorithm())
    {
    case BPAlgorithms::FFD_1D_ORDER_ITEMS_NO_SPLIT:
        bp_solver::baseLineFFD(this->item_vect, &this->box_vect, bc.getFirstBox());
        break;
    case BPAlgorithms::FFD_1D_ORDER_ITEMS_SPLIT_ONE_BOX_TYPE:
        bp_solver::mainSolution1DFFD_oneBoxType(this->item_vect, &this->box_vect, bc.getFirstBox());
        break;
    case BPAlgorithms::FFDS_1D_ORDER_ITEMS_SPLIT_MULTI_BOX_TYPE:
        bp_solver::mainSolution1DFFDS_multipleBoxTypes(this->item_vect, &this->box_vect, bc.getBoxesVector());
        break;
    case BPAlgorithms::PYLIB_3D_FFDSEnhance_ORDER_ITEMS_SPLIT_MULTI_BOX_TYPE:
        bp_solver::mainSolution3DBP_FFDS_multiBoxTypes_pythonScript(this->item_vect, &this->box_vect, bc.getBoxesVector());
        break;
    case BPAlgorithms::PYLIB_3D_ORDER_ITEMS_SPLIT_MULTI_BOX_TYPE_COUNT_DEFINED:
        bp_solver::mainSolution3DBP_multipleBoxTypes_countDefined_pythonScript(this->item_vect, &this->box_vect, bc.getBoxesWCountVector());
        break;
    case BPAlgorithms::PYLIB_3D_ORDER_ITEMS_SPLIT_ONE_BOX_TYPE:
        bp_solver::mainSolution3DBP_oneBox_pythonScript(this->item_vect, &this->box_vect, bc.getFirstBox());
        break;
    default /* as SolverConfiguration::BPAlgorithms::FFD_1D_ORDER_ITEMS_SPLIT_ONE_BOX_TYPE:*/:
        break;
    }
}

vector<Box> Customer::getBoxesDecomp()
{
    return this->box_vect;
}

void Customer::setBoxesDecomp(vector<Box> _box_vect)
{
    this->box_vect = _box_vect;
}

float Customer::getTotalWeight()
{
    return this->total_weight;
}

float Customer::getTotalVolume()
{
    return this->total_volume;
}

int Customer::getCustomerID()
{
    return this->customer_id;
}
