/***********************************************************************************

    Copyright (C) 2007-2026 Ahmet Öztürk (aoz_2@yahoo.com)

    This file is part of Lifeograph.

    Lifeograph is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Lifeograph is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Lifeograph.  If not, see <http://www.gnu.org/licenses/>.

***********************************************************************************/


#ifndef LIFEOGRAPH_PYHTON_BINDINGS_HEADER
#define LIFEOGRAPH_PYHTON_BINDINGS_HEADER


#include <filesystem>

#include "../helpers.hpp"
#include "../diaryelements/entry.hpp"
#include "src/diaryelements/diarydata.hpp"

namespace LoG
{

using namespace HELPERS;

enum class  ScriptCategory  { TBD, NONE, IMPORTER, EXPORTER, TABLE_COLUMN,
                              WORD_MODIFIER, PARA_MODIFIER, ENTRY_MODIFIER, FILTER };
enum class  ScriptOrigin    { FILE, ENTRY };



namespace PyBindings
{
    using VecCompletions = std::vector< std::tuple< String, String, String, int > >;

    void              get_scripts( ScriptCategory, VecUstrings& );
    void              get_scripts( const Entry*, VecUstrings& );

    DateV             get_entry_check_date();
    void              set_entry_check_date( DateV );

    void              load_script_files( const String& );
    void              preload_py_file( const std::filesystem::path& );
    void              preload_py_paras( const Paragraph*, const Paragraph* );

    void              update_scripts_in_entries( bool );
    void              update_for_entry( const Entry*, bool );

    void              remove_entry_based_scripts();
    void              remove_file_based_scripts();

    void              edit_script( const String& );

    void              run_script_onthefly( Paragraph* );

    template< typename... Args >
    bool              run_script_name( const String& script_name, Args&&... args );
    template< typename... Args >
    bool              run_script_name_func( const String& script_name,
                                            const String& func_name, Args&&... args );
    template< typename T, typename... Args >
    T                 run_script_name_return( const String& script_name,
                                              const String& func_name, Args&&... args );

    VecCompletions    get_completions( const String&, int );
}

} // end of namespace LoG

#endif
