#pragma once

#include "Base_config.h"

namespace p2c
{

struct Left_body_config : public Base_config
{
    std::string dir_project;
    std::string fn_pointset;
    std::string fn_landmarks;
    std::string fn_landmark_validity;
    std::string fn_invtrans_mesh;
    std::string fn_invtrans_final_mesh;
    std::string fn_metashape_project;
    std::string fn_texture;
    std::string fn_openpose_keypoint_folder;
    std::string fn_cameras;

    bool b_textured;
    bool b_provide_texture_manually;
    bool b_repair_hand_texture;
    bool b_repair_armpit_texture;
    bool b_replace_floor_plane;
    bool b_openpose_landmarks;
    bool b_inspect_detected_landmarks;
    bool b_write_invtrans_even_if_not_textured;

    int int_detail_level;

    Left_body_config() :
        b_textured(true),
        b_provide_texture_manually(false),
        b_repair_hand_texture(true),
        b_repair_armpit_texture(true),
        b_replace_floor_plane(true),
        b_openpose_landmarks(false),
        b_inspect_detected_landmarks(true),
        b_write_invtrans_even_if_not_textured(false),
        int_detail_level(2)
    {}

    void init(const std::vector<std::string>& argv, std::map<std::string, std::string>& data)
    {
        for (size_t i=0; i < argv.size(); ++i)
        {
            if (argv[i] == "-bleft" && argv.size() > i+1)
            {
                dir_project = argv[i+1];
                if (dir_project.back() != '/')
                    dir_project.push_back('/');
            }
        }

        find_key(data, "fn_pointset", fn_pointset, dir_project);
        find_key(data, "fn_landmarks", fn_landmarks, dir_project);
        find_key(data, "fn_landmark_validity", fn_landmark_validity, dir_project);
        find_key(data, "fn_invtrans_mesh", fn_invtrans_mesh, dir_project);
        find_key(data, "fn_invtrans_final_mesh", fn_invtrans_final_mesh, dir_project);
        find_key(data, "fn_metashape_project", fn_metashape_project, dir_project);
        find_key(data, "fn_texture", fn_texture, dir_project);
        find_key(data, "fn_openpose_keypoint_folder", fn_openpose_keypoint_folder, dir_project);
        find_key(data, "fn_cameras", fn_cameras, dir_project);

        find_key(data, "b_textured", b_textured);
        find_key(data, "b_provide_texture_manually", b_provide_texture_manually);
        find_key(data, "b_repair_hand_texture", b_repair_hand_texture);
        find_key(data, "b_repair_armpit_texture", b_repair_armpit_texture);
        find_key(data, "b_replace_floor_plane", b_replace_floor_plane);
        find_key(data, "b_openpose_landmarks", b_openpose_landmarks);
        find_key(data, "b_inspect_detected_landmarks", b_inspect_detected_landmarks);
        find_key(data, "b_write_invtrans_even_if_not_textured", b_write_invtrans_even_if_not_textured);


        find_key(data, "int_detail_level", int_detail_level);

    }

};

}
