from pathlib import Path

import pandas as pd

from ..provider_base import ProviderBase


class Provider(ProviderBase):

    def __init__(self):
        super().__init__()
        self.storage = self.storage_root() / "arbo"

    def header(self):
        """Header of data stored

        Returns:
            (dict): [unit] description per columns
        """
        return {}

    def pth_storage(self, pth, anchor):
        """Normalized name associated to given coordinates

        Args:
            pth (Path): path to local file
            anchor (str): name of directory to use as anchor to make pth relative

        Returns:
            (Pth)
        """
        return self.storage / pth.name


    def get(self, pth, anchor="work"):
        """Get local pth from previously pushed file in storage.

        Args:
            pth (Path): path to local file
            anchor (str): name of directory to use as anchor to make pth relative

        Returns:
            (pd.DataFrame): name of columns varies
        """
        if isinstance(pth, str):
            pth = Path(pth)

        df = pd.read_csv(self.pth_storage(pth), sep=";", comment="#")

        return df
