from kedro.pipeline import Pipeline, node, pipeline

from .nodes import populate_mongo, load_houses, load_helpers


def create_pipeline(**kwargs) -> Pipeline:
    return pipeline(
        [
            node(
                func=populate_mongo,
                inputs=["bourbon_fulljsonoutput", "params:storage_ip", "params:db_name", 
                        "params:db_collection_name", "params:mongodb_admin",
                        "params:mongodb_password"],
                outputs=None,
                name="bourbon_populate_actes",
                tags="populate_database",
            ),
            node(
                func=populate_mongo,
                inputs=["berry_fulljsonoutput", "params:storage_ip", "params:db_name", 
                        "params:db_collection_name", "params:mongodb_admin",
                        "params:mongodb_password"],
                outputs=None,
                name="berry_populate_actes",
                tags="populate_database",
            ),
            node(
                func=populate_mongo,
                inputs=["anjou_fulljsonoutput", "params:storage_ip", "params:db_name", 
                        "params:db_collection_name", "params:mongodb_admin",
                        "params:mongodb_password"],
                outputs=None,
                name="anjou_populate_actes",
                tags="populate_database",
            ),
            node(
                func=load_houses,
                inputs=["houses", "params:storage_ip", "params:db_name", 
                        "params:mongodb_admin", "params:mongodb_password"],
                outputs=None,
                name="polulate_houses",
                tags="populate_database",
            ),
            node(
                func=load_helpers,
                inputs=["houses_trigram","prince_bigram", 
                        "params:storage_ip", "params:db_name", 
                        "params:mongodb_admin", "params:mongodb_password"],
                outputs=None,
                name="populate_helpers",
                tags="populate_database",
            )
        ]
    )

