# Path: lcopt/data_store.py
# class LcoptStorage():
#     def __init__(self):
#     def load_config(self):
#     def refresh(self):
#     def write_default_config(self):
#     def write_config(self, config):
#     def models(self):
#     def search_indices(self):
#     def project_type(self):
#     def single_project_name(self):
#     def ecoinvent_version(self):
#     def ecoinvent_system_model(self):
#     def save_option(self):


import numpy as np
import json
import os
from scipy.sparse import coo_matrix
from .data_store import storage
            matrix[coords[0], coords[1]] = v

    return matrix

def export_disclosure(model, parameter_set=None, folder_path=None):
    
    if parameter_set is None:
        matrix = model.matrix.copy()
        filename = '{}_unspecified.json'.format(model.name.replace(" ", "_"))

    else:
        matrix = specify_matrix(model, parameter_set)
        filename = '{}_ps_{}.json'.format(model.name.replace(" ", "_"), parameter_set)

    if model.save_option == 'curdir':
        base_dir = os.getcwd()
    else:
        base_dir = storage.disclosures_dir

    if isinstance(folder_path, str):
        export_folder = os.path.join(base_dir, folder_path)
        if not os.path.isdir(export_folder):
            os.mkdir(export_folder)
    else:
        export_folder = base_dir            
    
    efn = os.path.join(export_folder, filename)

    background = [(i, x) for i, x in enumerate(model.names) if list(matrix.sum(axis=0))[i] == 0]
    foreground = [(i, x) for i, x in enumerate(model.names) if list(matrix.sum(axis=0))[i] != 0]

# Path: lcopt/data_store.py
# class LcoptStorage():
#     def __init__(self):
#     def load_config(self):
#     def refresh(self):
#     def write_default_config(self):
#     def write_config(self, config):
#     def models(self):
#     def search_indices(self):
#     def project_type(self):
#     def single_project_name(self):
#     def ecoinvent_version(self):
#     def ecoinvent_system_model(self):
#     def save_option(self):


# Path: lcopt/export_disclosure.py
import numpy as np
import json
import os
from scipy.sparse import coo_matrix
from .data_store import storage

            matrix[coords[0], coords[1]] = v

    return matrix

def export_disclosure(model, parameter_set=None, folder_path=None):
    
    if parameter_set is None:
        matrix = model.matrix.copy()
        filename = '{}_unspecified.json'.format(model.name.replace(" ", "_"))

    else:
        matrix = specify_matrix(model, parameter_set)
        filename = '{}_ps_{}.json'.format(model.name.replace(" ", "_"), parameter_set)

    if model.save_option == 'curdir':
        base_dir = os.getcwd()
    else:
        base_dir = storage.disclosures_dir

    if isinstance(folder_path, str):
        export_folder = os.path.join(base_dir, folder_path)
        if not os.path.isdir(export_folder):
            os.mkdir(export_folder)
    else:
        export_folder = base_dir            
    
    efn = os.path.join(export_folder, filename)

    background = [(i, x) for i, x in enumerate(model.names) if list(matrix.sum(axis=0))[i] == 0]
    foreground = [(i, x) for i, x in enumerate(model.names) if list(matrix.sum(axis=0))[i] != 0]

    fu = [(i, x) for i, x in enumerate(model.names) if list(matrix.sum(axis=1))[i] == 0 and list(matrix.sum(axis=0))[i] != 0]