
from kedro.pipeline import Pipeline, node, pipeline

from .nodes import (parse_xml_collection, make_json_collection,
                   add_xmlcontent_tojson)


def create_pipeline(**kwargs) -> Pipeline:
    return pipeline(
        [
        # bourbon
            node(
                func=parse_xml_collection,
                inputs=["bourbon"],
                outputs="bourbon_xmlcontent",
                name="bourbon_ds_collection",
                tags="etl_transform"
            ),
            node(
                func=make_json_collection,
                inputs="bourbon_json",
                outputs="bourbon_jsonoutput",
                name="bourbon_json_ds_collection",
                tags="etl_transform"
            ),
            node(
                func=add_xmlcontent_tojson,
                inputs=["bourbon_jsonoutput", "bourbon_pseudoxmlcontent"],
                outputs="bourbon_fulljsonoutput",
                name="bourbon_fulljson_ds_collection",
                tags="etl_transform"
            ),
        # berry
            node(
                func=parse_xml_collection,
                inputs=["berry"],
                outputs="berry_xmlcontent",
                name="berry_ds_collection",
                tags="etl_transform"
            ),
            node(
                func=make_json_collection,
                inputs="berry_json",
                outputs="berry_jsonoutput",
                name="berry_json_ds_collection",
                tags="etl_transform"
            ),
            node(
                func=add_xmlcontent_tojson,
                inputs=["berry_jsonoutput", "berry_pseudoxmlcontent"],
                outputs="berry_fulljsonoutput",
                name="berry_fulljson_ds_collection",
                tags="etl_transform"
            ),
        # anjou
            node(
                func=parse_xml_collection,
                inputs=["anjou"],
                outputs="anjou_xmlcontent",
                name="anjou_ds_collection",
                tags="etl_transform"
            ),
            node(
                func=make_json_collection,
                inputs="anjou_json",
                outputs="anjou_jsonoutput",
                name="anjou_json_ds_collection",
                tags="etl_transform"
            ),
            node(
                func=add_xmlcontent_tojson,
                inputs=["anjou_jsonoutput", "anjou_pseudoxmlcontent"],
                outputs="anjou_fulljsonoutput",
                name="anjou_fulljson_ds_collection",
                tags="etl_transform"
            ),

        ]
    )

