from src.impl.datastore import Datastore, DataItem
from src.impl.indexer import Indexer
from src.impl.retriever import Retriever
from src.impl.response_generator import ResponseGenerator
TEST_PATH = "data/source"
def main():
    query_graphiste = "Quel est le salaire brut mensuel du graphiste ?"
    query_graphiste_en = "What is the monthly gross salary of the graphist designer ?"
    print("Testing indexer")
    indexer = Indexer()
    items_from_indexer = indexer.index(["data/source/database.pdf",
                                        "data/source/bilan_comptable_2024.pdf",
                                        "data/source/employes.pdf",
                                        "data/source/facture_14_03_2025.pdf",
                                        "data/source/fournisseurs.pdf",
                                        "data/source/historique_commandes.pdf",
                                        "data/source/planning_production_mars_2025.pdf",
                                        ])                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         


    print("Testing datastore")
    datastore = Datastore()
    print(f"Model's maximum sequence length:{datastore.model.max_seq_length}")
    test_vector = datastore.create_vector("test")
    
    data_item_to_test = DataItem(
        content = "Data item being tested",
        source = "from a test"
    )
    
    datastore.add_items([data_item_to_test])
    
    datastore.add_items(items_from_indexer)
    print(datastore.search_datastore(("Data item being tested")))
    print(datastore.search_datastore("Red t-shirt"))
    
    print("Testing retriever")
    retriever = Retriever(datastore= datastore)
    print(retriever.search_retriever(query_graphiste))
    
    print("Testing Response generator")
    #response_generator = ResponseGenerator()
    #print(response_generator.generate_response(query_graphiste, retriever.search_retriever(query_graphiste)))
    print("fin")
    exit
    
main()