#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from .abc import Abstract_ADBDGL_Controller
from .typings import DGLCanonicalEType, Json


class ADBDGL_Controller(Abstract_ADBDGL_Controller):
    """ArangoDB-DGL controller.

    Responsible for controlling how nodes & edges are handled when
    transitioning from DGL to ArangoDB.

    You can derive your own custom ADBDGL_Controller.
    """

    def _prepare_dgl_node(self, dgl_node: Json, node_type: str) -> Json:
        """Prepare a DGL node object before it gets inserted into its
        designated ArangoDB collection.

        Given a JSON representation of a DGL node, you can modify it
        before it gets inserted into its ArangoDB collection,
        and/or derive a custom vertex id by updating the "_key" attribute
        of the vertex (otherwise the vertex's current "_key" value will be used).

        :param dgl_node: The DGL node object to (optionally) modify.
        :type dgl_node: adbnx_adapter.typings.Json
        :param node_type: The DGL Node Type of the node
        :type node_type: str
        :return: The DGL Node object
        :rtype: Dict[str, Any]
        """
        return dgl_node  # pragma: no cover

    def _prepare_dgl_edge(self, dgl_edge: Json, edge_type: DGLCanonicalEType) -> Json:
        """Prepare a DGL edge object before it gets inserted into its
        designated ArangoDB collection.

        Given a JSON representation of a DGL edge, you can modify it
        before it gets inserted into its ArangoDB edge collection,
        and/or derive a custom edge id by setting the "_key" attribute
        of the edge (otherwise the "_key" will be randomly generated by ArangoDB).

        :param dgl_edge: The DGL edge object to (optionally) modify.
        :type dgl_edge: adbnx_adapter.typings.Json
        :param edge_type: The Edge Type of The DGL edge. Formatted
            as (from_collection, edge_collection, to_collection)
        :type edge_type: Tuple[str, str, str]
        :return: The DGL Edge object
        :rtype: Dict[str, Any]
        """
        return dgl_edge  # pragma: no cover
