from pathlib import Path


def get_save_path(fig_panel_analysis, main_direc=None):
    """
    get_save_path(fig_panel_analysis)

    Returns directory path amended with data file subdirectory.

    Required args:
        - fig_panel_analysis (FigPanelAnalysis): 
            figure/panel analysis object
    
    Optional args:
        - main_direc (Path): 
            main directory to save file in
            default: None
    
    Returns:
        - savedir (Path): 
            specific directory to save file in
        - savename (str): 
            name under with to save file
    """

    savedir = Path(f"Fig{fig_panel_analysis.figure}")
    savename = f"panel_{fig_panel_analysis.panel}"

    if main_direc is not None:
        savedir = main_direc.joinpath(savedir)

    if not (fig_panel_analysis.full_power and fig_panel_analysis.paper_seed):
        savedir = savedir.joinpath("panels_with_diff_params")
        if not (fig_panel_analysis.full_power):
            savename = f"{savename}_lower_power"
        if not (fig_panel_analysis.paper_seed):
            savename = f"{savename}_seed{fig_panel_analysis.seed}"
            
    return savedir, savename