#ifndef TEMPLATE_CONFIG_H
#define TEMPLATE_CONFIG_H

#include "Base_config.h"

namespace p2c
{
struct Template_config : public Base_config
{
    std::string dir_template_db;
    std::string fn_template;
    std::string fn_template_head;
    std::string fn_template_hand_left;
    std::string fn_template_hand_right;
    std::string fn_landmarks_template;
    std::string fn_landmarks_body;
    std::string fn_landmarks_body_weighted;
    std::string fn_landmarks_front_body;
    std::string fn_landmarks_front_body_weighted;
    std::string fn_landmarks_back_body;
    std::string fn_landmarks_right_body;
    std::string fn_landmarks_left_body;
    std::string fn_lm_guidance_body;
    std::string fn_lm_guidance_face;
    std::string fn_lm_guidance_right_hand;
    std::string fn_lm_guidance_left_hand;
    std::string fn_lm_guidance_front_body;
    std::string fn_lm_guidance_back_body;
    std::string fn_lm_guidance_left_body;
    std::string fn_lm_guidance_right_body;
    std::string fn_landmarks_face_ears;
    std::string fn_landmarks_facialfeatures;
    std::string fn_landmarks_facialfeatures_head_fitting;
    std::string fn_landmarks_hand_left;
    std::string fn_landmarks_hand_right;
    std::string fn_landmarks_hand_left_mapping;
    std::string fn_landmarks_hand_right_mapping;
    std::string fn_landmarks_description_body;
    std::string fn_landmarks_description_face;
    std::string fn_template_ik_dof;
    std::string fn_template_ik_dof_face;
    std::string fn_template_ik_dof_landmarks;
    std::string fn_template_ik_dof_hand_left;
    std::string fn_template_ik_dof_hand_right;
    std::string fn_mapping_body2head;
    std::string fn_mapping_head2body;
    std::string fn_pca_body_mean_mesh;
    std::string fn_pca_body;
    std::string fn_pca_head_mean_mesh;
    std::string fn_pca_head;
    std::string fn_pca_head_boundary_neck;
    std::string fn_pca_left_hand;
    std::string fn_pca_left_hand_mean_mesh;
    std::string fn_pca_left_hand_selection;
    std::string fn_pca_right_hand;
    std::string fn_pca_right_hand_mean_mesh;
    std::string fn_pca_right_hand_selection;
    std::string fn_skinning_info_pos;
    std::string fn_joint_positions_chargen;
    std::string fn_skinning_info_wd;
    std::string fn_vw_fullbody_hands_fitting;
    std::string fn_vw_hands_regularization;
    std::string fn_vw_shoulders_regularization;
    std::string fn_vw_fullbody_face_fitting;
    std::string fn_vw_face_and_ears_fitting;
    std::string fn_vw_forearms_fitting;
    std::string fn_vw_forearms_pose_fitting;
    std::string fn_vw_head_neckboundary;
    std::string fn_vw_oralcavity;
    std::string fn_vw_oralcavity_more_regularization;
    std::string fn_vw_ik;
    std::string fn_vw_left_half;
    std::string fn_vw_right_half;
    std::string fn_vw_head_regularization;
    std::string fn_vw_soles;
    std::string fn_sel_keep_vertices;
    std::string fn_sel_keep_vertices_eyes;
    std::string fn_sel_keep_body_vertices;
    std::string fn_sel_eyelid_fitting_inverse;
    std::string fn_sel_keep_nohands_vertices;
    std::string fn_sel_mouth_shut;
    std::string fn_sel_sole_vertices;
    std::string fn_sel_sole_vertices_inverse;
    std::string fn_sel_mouth_region;
    std::string fn_sel_eyeregion_left;
    std::string fn_sel_eyeregion_right;
    std::string fn_sel_eye_mesh_vertices_left;
    std::string fn_sel_eye_mesh_vertices_right;
    std::string fn_sel_deftrans_fixed_vertices;
    std::string fn_sel_vertices_to_omit;
    std::string fn_sel_eye_vertices_to_omit;
    std::string fn_sel_eyecontour_left;
    std::string fn_sel_eyecontour_right;
    std::string fn_sel_eyecontour_left_without_gland;
    std::string fn_sel_eyecontour_right_without_gland;
    std::string fn_sel_teeth_up_vertices_to_delete;
    std::string fn_sel_oralcavity_vertices_to_delete;
    std::string fn_sel_teeth_up_vertices_to_squash;
    std::string fn_sel_eyelids_folds;
    std::string fn_sel_heels;
    std::string fn_sel_left_ear_scale;
    std::string fn_sel_right_ear_scale;
    std::string fn_mask_eyes_and_teeth_inverse;
    std::string fn_mask_hands_comparison;
    std::string fn_mask_hands_repair;
    std::string fn_mask_hands_repair_start;
    std::string fn_mask_hands_repair_min;
    std::string fn_mask_hands_repair_max;
    std::string fn_mask_hand_left_repair;
    std::string fn_mask_hand_right_repair;
    std::string fn_mask_hands_dirichlet;
    std::string fn_mask_handscan_dirichlet;
    std::string fn_mask_histogram_match_right;
    std::string fn_mask_histogram_match_left;
    std::string fn_mask_armpit_repair;
    std::string fn_mask_face_and_ears;
    std::string fn_mask_head_texture;
    std::string fn_mask_head_texture_dirichlet;
    std::string fn_mask_fullbody;
    std::string fn_mask_critical_overlap_region;
    std::string fn_mask_front;
    std::string fn_mask_back;
    std::string fn_mask_left;
    std::string fn_mask_right;
    std::string fn_facialfeatures_model;
    std::string fn_eye_proxy;
    std::string fn_skeleton_convert_info;
    std::string fn_retargeting_skeleton;
    std::string fn_retargeting_excluded_joints;
    std::string fn_selection_for_normal_flip;
    std::string fn_selection_mesh2ps_filter;

    std::string s_eyejoint_left;
    std::string s_eyejoint_right;
    std::string s_eyemesh_left;
    std::string s_eyemesh_right;
    std::string s_eyetrans_left;
    std::string s_eyetrans_right;
    std::string s_eyegland_left;
    std::string s_eyegland_right;
    std::string s_bodymesh;
    std::string s_eyemesh;
    std::string s_eyetransmesh;
    std::string s_teeth_up;
    std::string s_teeth_down;

    std::string fn_vertexweighting;

    bool b_do_vertexweighting;
    bool b_shapedependent_skinningweights;
    bool b_jointposcorrection_chargen;
    bool b_trim_oralcavity_and_teeth;
    bool b_keep_eye_vertices;
    bool b_eye_meshes_are_combined;
    bool b_align_root_joint;
    bool b_squash_teeth_up_vertex_ring;
    bool b_mesh2ps_filter_selection;

    Template_config() :
        b_do_vertexweighting(false),
        b_shapedependent_skinningweights(false),
        b_jointposcorrection_chargen(false),
        b_trim_oralcavity_and_teeth(false),
        b_keep_eye_vertices(false),
        b_eye_meshes_are_combined(false),
        b_align_root_joint(false),
        b_squash_teeth_up_vertex_ring(false),
        b_mesh2ps_filter_selection(false)
    {
    }

    void init(const std::vector<std::string>& argv, std::map<std::string, std::string>& data)
    {

        //find_key(data, "dir_template_db", dir_template_db);


        for (size_t i=0; i < argv.size(); ++i)
        {
            if (argv[i] == "-t" && argv.size() > i+1)
            {
                dir_template_db = argv[i+1];
                if (dir_template_db.back() != '/')
                    dir_template_db.push_back('/');
            }
        }

        find_key(data, "fn_template", fn_template, dir_template_db);
        find_key(data, "fn_template_head", fn_template_head, dir_template_db);
        find_key(data, "fn_template_hand_left", fn_template_hand_left, dir_template_db);
        find_key(data, "fn_template_hand_right", fn_template_hand_right, dir_template_db);
        find_key(data, "fn_landmarks_template", fn_landmarks_template, dir_template_db);
        find_key(data, "fn_landmarks_body", fn_landmarks_body, dir_template_db);
        find_key(data, "fn_landmarks_body_weighted", fn_landmarks_body_weighted, dir_template_db);
        find_key(data, "fn_landmarks_front_body", fn_landmarks_front_body, dir_template_db);
        find_key(data, "fn_landmarks_front_body_weighted", fn_landmarks_front_body_weighted, dir_template_db);
        find_key(data, "fn_landmarks_back_body", fn_landmarks_back_body, dir_template_db);
        find_key(data, "fn_landmarks_left_body", fn_landmarks_left_body, dir_template_db);
        find_key(data, "fn_landmarks_right_body", fn_landmarks_right_body, dir_template_db);
        find_key(data, "fn_lm_guidance_front_body", fn_lm_guidance_front_body, dir_template_db);
        find_key(data, "fn_lm_guidance_back_body", fn_lm_guidance_back_body, dir_template_db);
        find_key(data, "fn_lm_guidance_left_body", fn_lm_guidance_left_body, dir_template_db);
        find_key(data, "fn_lm_guidance_right_body", fn_lm_guidance_right_body, dir_template_db);
        find_key(data, "fn_lm_guidance_body", fn_lm_guidance_body, dir_template_db);
        find_key(data, "fn_lm_guidance_face", fn_lm_guidance_face, dir_template_db);
        find_key(data, "fn_lm_guidance_right_hand", fn_lm_guidance_right_hand, dir_template_db);
        find_key(data, "fn_lm_guidance_left_hand", fn_lm_guidance_left_hand, dir_template_db);
        find_key(data, "fn_landmarks_face_ears", fn_landmarks_face_ears, dir_template_db);
        find_key(data, "fn_landmarks_facialfeatures", fn_landmarks_facialfeatures, dir_template_db);
        find_key(data, "fn_landmarks_facialfeatures_head_fitting", fn_landmarks_facialfeatures_head_fitting, dir_template_db);
        find_key(data, "fn_landmarks_hand_left", fn_landmarks_hand_left, dir_template_db);
        find_key(data, "fn_landmarks_hand_right", fn_landmarks_hand_right, dir_template_db);
        find_key(data, "fn_landmarks_hand_left_mapping", fn_landmarks_hand_left_mapping, dir_template_db);
        find_key(data, "fn_landmarks_hand_right_mapping", fn_landmarks_hand_right_mapping, dir_template_db);
        find_key(data, "fn_landmarks_description_body", fn_landmarks_description_body, dir_template_db);
        find_key(data, "fn_landmarks_description_face", fn_landmarks_description_face, dir_template_db);
        find_key(data, "fn_template_ik_dof", fn_template_ik_dof, dir_template_db);
        find_key(data, "fn_template_ik_dof_face", fn_template_ik_dof_face, dir_template_db);
        find_key(data, "fn_template_ik_dof_landmarks", fn_template_ik_dof_landmarks, dir_template_db);
        find_key(data, "fn_template_ik_dof_hand_left", fn_template_ik_dof_hand_left, dir_template_db);
        find_key(data, "fn_template_ik_dof_hand_right", fn_template_ik_dof_hand_right, dir_template_db);
        find_key(data, "fn_mapping_body2head", fn_mapping_body2head, dir_template_db);
        find_key(data, "fn_mapping_head2body", fn_mapping_head2body, dir_template_db);
        find_key(data, "fn_pca_body_mean_mesh", fn_pca_body_mean_mesh, dir_template_db);
        find_key(data, "fn_pca_body", fn_pca_body, dir_template_db);
        find_key(data, "fn_pca_head_mean_mesh", fn_pca_head_mean_mesh, dir_template_db);
        find_key(data, "fn_pca_head", fn_pca_head, dir_template_db);
        find_key(data, "fn_pca_head_boundary_neck", fn_pca_head_boundary_neck, dir_template_db);
        find_key(data, "fn_pca_left_hand", fn_pca_left_hand, dir_template_db);
        find_key(data, "fn_pca_left_hand_mean_mesh", fn_pca_left_hand_mean_mesh, dir_template_db);
        find_key(data, "fn_pca_left_hand_selection", fn_pca_left_hand_selection, dir_template_db);
        find_key(data, "fn_pca_right_hand", fn_pca_right_hand, dir_template_db);
        find_key(data, "fn_pca_right_hand_mean_mesh", fn_pca_right_hand_mean_mesh, dir_template_db);
        find_key(data, "fn_pca_right_hand_selection", fn_pca_right_hand_selection, dir_template_db);
        find_key(data, "b_shapedependent_skinningweights", b_shapedependent_skinningweights);
        find_key(data, "b_jointposcorrection_chargen", b_jointposcorrection_chargen);
        find_key(data, "fn_skinning_info_pos", fn_skinning_info_pos, dir_template_db);
        find_key(data, "fn_joint_positions_chargen", fn_joint_positions_chargen, dir_template_db);
        find_key(data, "fn_skinning_info_wd", fn_skinning_info_wd, dir_template_db);
        find_key(data, "fn_vw_fullbody_hands_fitting", fn_vw_fullbody_hands_fitting, dir_template_db);
        find_key(data, "fn_vw_hands_regularization", fn_vw_hands_regularization, dir_template_db);
        find_key(data, "fn_vw_shoulders_regularization", fn_vw_shoulders_regularization, dir_template_db);
        find_key(data, "fn_vw_fullbody_face_fitting", fn_vw_fullbody_face_fitting, dir_template_db);
        find_key(data, "fn_vw_face_and_ears_fitting", fn_vw_face_and_ears_fitting, dir_template_db);
        find_key(data, "fn_vw_forearms_fitting", fn_vw_forearms_fitting, dir_template_db);
        find_key(data, "fn_vw_forearms_pose_fitting", fn_vw_forearms_pose_fitting, dir_template_db);
        find_key(data, "fn_vw_head_neckboundary", fn_vw_head_neckboundary, dir_template_db);
        find_key(data, "fn_vw_oralcavity", fn_vw_oralcavity, dir_template_db);
        find_key(data, "fn_vw_oralcavity_more_regularization", fn_vw_oralcavity_more_regularization, dir_template_db);
        find_key(data, "fn_vw_ik", fn_vw_ik, dir_template_db);
        find_key(data, "fn_vw_left_half", fn_vw_left_half, dir_template_db);
        find_key(data, "fn_vw_right_half", fn_vw_right_half, dir_template_db);
        find_key(data, "fn_vw_head_regularization", fn_vw_head_regularization, dir_template_db);
        find_key(data, "fn_vw_soles", fn_vw_soles, dir_template_db);
        find_key(data, "fn_sel_keep_vertices", fn_sel_keep_vertices, dir_template_db);
        find_key(data, "fn_sel_keep_vertices_eyes", fn_sel_keep_vertices_eyes, dir_template_db);
        find_key(data, "b_keep_eye_vertices", b_keep_eye_vertices);
        find_key(data, "fn_sel_keep_body_vertices", fn_sel_keep_body_vertices, dir_template_db);
        find_key(data, "fn_sel_eyelid_fitting_inverse", fn_sel_eyelid_fitting_inverse, dir_template_db);
        find_key(data, "fn_sel_keep_nohands_vertices", fn_sel_keep_nohands_vertices, dir_template_db);
        find_key(data, "fn_sel_mouth_shut", fn_sel_mouth_shut, dir_template_db);
        find_key(data, "fn_sel_sole_vertices", fn_sel_sole_vertices, dir_template_db);
        find_key(data, "fn_sel_sole_vertices_inverse", fn_sel_sole_vertices_inverse, dir_template_db);
        find_key(data, "fn_sel_mouth_region", fn_sel_mouth_region, dir_template_db);
        find_key(data, "fn_sel_eyeregion_left", fn_sel_eyeregion_left, dir_template_db);
        find_key(data, "fn_sel_eyeregion_right", fn_sel_eyeregion_right, dir_template_db);
        find_key(data, "fn_sel_eye_mesh_vertices_left", fn_sel_eye_mesh_vertices_left, dir_template_db);
        find_key(data, "fn_sel_eye_mesh_vertices_right", fn_sel_eye_mesh_vertices_right, dir_template_db);
        find_key(data, "fn_sel_deftrans_fixed_vertices", fn_sel_deftrans_fixed_vertices, dir_template_db);
        find_key(data, "fn_sel_vertices_to_omit", fn_sel_vertices_to_omit, dir_template_db);
        find_key(data, "fn_sel_eye_vertices_to_omit", fn_sel_eye_vertices_to_omit, dir_template_db);
        find_key(data, "fn_sel_eyecontour_left", fn_sel_eyecontour_left, dir_template_db);
        find_key(data, "fn_sel_eyecontour_right", fn_sel_eyecontour_right, dir_template_db);
        find_key(data, "fn_sel_eyecontour_left_without_gland", fn_sel_eyecontour_left_without_gland, dir_template_db);
        find_key(data, "fn_sel_eyecontour_right_without_gland", fn_sel_eyecontour_right_without_gland, dir_template_db);
        find_key(data, "b_trim_oralcavity_and_teeth", b_trim_oralcavity_and_teeth);
        find_key(data, "b_eye_meshes_are_combined", b_eye_meshes_are_combined);
        find_key(data, "fn_sel_teeth_up_vertices_to_delete", fn_sel_teeth_up_vertices_to_delete, dir_template_db);
        find_key(data, "fn_sel_oralcavity_vertices_to_delete", fn_sel_oralcavity_vertices_to_delete, dir_template_db);
        find_key(data, "b_squash_teeth_up_vertex_ring", b_squash_teeth_up_vertex_ring);
        find_key(data, "fn_sel_teeth_up_vertices_to_squash", fn_sel_teeth_up_vertices_to_squash, dir_template_db);
        find_key(data, "fn_sel_eyelids_folds", fn_sel_eyelids_folds, dir_template_db);
        find_key(data, "fn_sel_heels", fn_sel_heels, dir_template_db);
        find_key(data, "fn_sel_left_ear_scale", fn_sel_left_ear_scale, dir_template_db);
        find_key(data, "fn_sel_right_ear_scale", fn_sel_right_ear_scale, dir_template_db);
        find_key(data, "fn_mask_eyes_and_teeth_inverse", fn_mask_eyes_and_teeth_inverse, dir_template_db);
        find_key(data, "fn_mask_hands_comparison", fn_mask_hands_comparison, dir_template_db);
        find_key(data, "fn_mask_hands_repair", fn_mask_hands_repair, dir_template_db);
        find_key(data, "fn_mask_hands_repair_start", fn_mask_hands_repair_start, dir_template_db);
        find_key(data, "fn_mask_hands_repair_min", fn_mask_hands_repair_min, dir_template_db);
        find_key(data, "fn_mask_hands_repair_max", fn_mask_hands_repair_max, dir_template_db);
        find_key(data, "fn_mask_hand_left_repair", fn_mask_hand_left_repair, dir_template_db);
        find_key(data, "fn_mask_hand_right_repair", fn_mask_hand_right_repair, dir_template_db);
        find_key(data, "fn_mask_hands_dirichlet", fn_mask_hands_dirichlet, dir_template_db);
        find_key(data, "fn_mask_handscan_dirichlet", fn_mask_handscan_dirichlet, dir_template_db);
        find_key(data, "fn_mask_histogram_match_right", fn_mask_histogram_match_right, dir_template_db);
        find_key(data, "fn_mask_histogram_match_left", fn_mask_histogram_match_left, dir_template_db);
        find_key(data, "fn_mask_armpit_repair", fn_mask_armpit_repair, dir_template_db);
        find_key(data, "fn_mask_face_and_ears", fn_mask_face_and_ears, dir_template_db);
        find_key(data, "fn_mask_head_texture", fn_mask_head_texture, dir_template_db);
        find_key(data, "fn_mask_head_texture_dirichlet", fn_mask_head_texture_dirichlet, dir_template_db);
        find_key(data, "fn_mask_fullbody", fn_mask_fullbody, dir_template_db);
        find_key(data, "fn_mask_critical_overlap_region", fn_mask_critical_overlap_region, dir_template_db);
        find_key(data, "fn_mask_front", fn_mask_front, dir_template_db);
        find_key(data, "fn_mask_back", fn_mask_back, dir_template_db);
        find_key(data, "fn_mask_left", fn_mask_left, dir_template_db);
        find_key(data, "fn_mask_right", fn_mask_right, dir_template_db);
        find_key(data, "fn_facialfeatures_model", fn_facialfeatures_model, dir_template_db);
        find_key(data, "fn_eye_proxy", fn_eye_proxy, dir_template_db);
        find_key(data, "fn_skeleton_convert_info", fn_skeleton_convert_info, dir_template_db);
        find_key(data, "fn_retargeting_skeleton", fn_retargeting_skeleton, dir_template_db);
        find_key(data, "fn_retargeting_excluded_joints", fn_retargeting_excluded_joints, dir_template_db);
        find_key(data, "b_do_vertexweighting", b_do_vertexweighting);
        find_key(data, "fn_vertexweighting", fn_vertexweighting, dir_template_db);
        find_key(data, "fn_selection_for_normal_flip", fn_selection_for_normal_flip, dir_template_db);
        find_key(data, "b_align_root_joint", b_align_root_joint);

        find_key(data, "fn_selection_mesh2ps_filter", fn_selection_mesh2ps_filter, dir_template_db);
        find_key(data, "b_mesh2ps_filter_selection", b_mesh2ps_filter_selection);


        find_key(data,"s_eyejoint_left", s_eyejoint_left);
        find_key(data,"s_eyejoint_right", s_eyejoint_right);
        find_key(data,"s_eyemesh_left", s_eyemesh_left);
        find_key(data,"s_eyemesh_right", s_eyemesh_right);
        find_key(data,"s_eyetrans_left", s_eyetrans_left);
        find_key(data,"s_eyetrans_right", s_eyetrans_right);
        find_key(data,"s_eyegland_left", s_eyegland_left);
        find_key(data,"s_eyegland_right", s_eyegland_right);
        find_key(data,"s_bodymesh", s_bodymesh);
        find_key(data,"s_eyemesh", s_eyemesh);
        find_key(data,"s_eyetransmesh", s_eyetransmesh);
        find_key(data,"s_teeth_up", s_teeth_up);
        find_key(data,"s_teeth_down", s_teeth_down);
    }
};
}


#endif
