# Path: pyDEA/core/data_processing/xlsx_workbook.py
# class XlsxWorkbook(object):
#     ''' This class wraps openpyxl workbook so it can be used by
#         FileWriter class.
# 
#         Attributes:
#             workbook (openpyxl workbook): workbook.
#             nb_sheets (int): number of added work sheets.
#     '''
#     def __init__(self):
#         self.workbook = Workbook()
#         self.nb_sheets = 0
# 
#     def add_sheet(self, sheet_name):
#         ''' Adds one sheet to the workbook.
# 
#             Args:
#                 sheet_name (str): name of the work sheet.
# 
#             Returns:
#                 XlsxSheet: created work sheet.
#         '''
#         self.nb_sheets += 1
#         if self.nb_sheets == 1:
#             worksheet = self.workbook.active
#         else:
#             worksheet = self.workbook.create_sheet()
#         worksheet.title = sheet_name
#         return XlsxSheet(worksheet)
# 
#     def save(self, file_name):
#         ''' Saves workbook to a given file.
# 
#             Args:
#                 file_name (str): name of the file where workbook should be
#                     saved.
#         '''
#         self.workbook.save(file_name)
# 
# class XlsxSheet(object):
#     ''' This class wraps openpyxl work sheet so that it can be used by FileWriter
#         class.
# 
#         Attributes:
#             name (str): work sheet name.
#             worksheet (openpyxl work sheet): worksheet to wrap.
# 
#         Args:
#             worksheet (openpyxl work sheet): worksheet to wrap.
#     '''
#     def __init__(self, worksheet):
#         self.worksheet = worksheet
# 
#     @property
#     def name(self):
#         return self.worksheet.title
# 
#     @name.setter
#     def name(self, value):
#         self.worksheet.title = value
# 
#     def write(self, row, col, value):
#         ''' Writes given value to a cell with specified row and column.
# 
#             Args:
#                 row (int): row index.
#                 col (int): column index.
#                 value (object): value to write.
#         '''
#         # +1 because openpyxl needs rows and cols to start from 1, not from 0
#         cell = self.worksheet.cell(row=row+1, column=col+1)
#         cell.value = value


from openpyxl import load_workbook
from pyDEA.core.data_processing.xlsx_workbook import XlsxWorkbook, XlsxSheet
from pyDEA.core.data_processing.solution_text_writer import OneCsvWriter
import os
''' This module implements function to write data to xlsx file.
'''




def create_workbook(output_file):
    ''' Creates a proper instance of data file writer depending on file extension.
        Supported formats are: xslx and csv.

        Args:
            output_file (str): file name.

        Returns:
            (XlsxWorkbook or OneCsvWriter): created data file
                writer instance.

        Raises:
            ValueError: if a file with not supported extension was provided.
    '''
    if output_file.endswith('.xlsx'):

# Path: pyDEA/core/data_processing/xlsx_workbook.py
# class XlsxWorkbook(object):
#     ''' This class wraps openpyxl workbook so it can be used by
#         FileWriter class.
# 
#         Attributes:
#             workbook (openpyxl workbook): workbook.
#             nb_sheets (int): number of added work sheets.
#     '''
#     def __init__(self):
#         self.workbook = Workbook()
#         self.nb_sheets = 0
# 
#     def add_sheet(self, sheet_name):
#         ''' Adds one sheet to the workbook.
# 
#             Args:
#                 sheet_name (str): name of the work sheet.
# 
#             Returns:
#                 XlsxSheet: created work sheet.
#         '''
#         self.nb_sheets += 1
#         if self.nb_sheets == 1:
#             worksheet = self.workbook.active
#         else:
#             worksheet = self.workbook.create_sheet()
#         worksheet.title = sheet_name
#         return XlsxSheet(worksheet)
# 
#     def save(self, file_name):
#         ''' Saves workbook to a given file.
# 
#             Args:
#                 file_name (str): name of the file where workbook should be
#                     saved.
#         '''
#         self.workbook.save(file_name)
# 
# class XlsxSheet(object):
#     ''' This class wraps openpyxl work sheet so that it can be used by FileWriter
#         class.
# 
#         Attributes:
#             name (str): work sheet name.
#             worksheet (openpyxl work sheet): worksheet to wrap.
# 
#         Args:
#             worksheet (openpyxl work sheet): worksheet to wrap.
#     '''
#     def __init__(self, worksheet):
#         self.worksheet = worksheet
# 
#     @property
#     def name(self):
#         return self.worksheet.title
# 
#     @name.setter
#     def name(self, value):
#         self.worksheet.title = value
# 
#     def write(self, row, col, value):
#         ''' Writes given value to a cell with specified row and column.
# 
#             Args:
#                 row (int): row index.
#                 col (int): column index.
#                 value (object): value to write.
#         '''
#         # +1 because openpyxl needs rows and cols to start from 1, not from 0
#         cell = self.worksheet.cell(row=row+1, column=col+1)
#         cell.value = value


# Path: pyDEA/core/data_processing/save_data_to_file.py
from openpyxl import load_workbook
from pyDEA.core.data_processing.xlsx_workbook import XlsxWorkbook, XlsxSheet
from pyDEA.core.data_processing.solution_text_writer import OneCsvWriter
import os

''' This module implements function to write data to xlsx file.
'''




def create_workbook(output_file):
    ''' Creates a proper instance of data file writer depending on file extension.
        Supported formats are: xslx and csv.

        Args:
            output_file (str): file name.

        Returns:
            (XlsxWorkbook or OneCsvWriter): created data file
                writer instance.

        Raises:
            ValueError: if a file with not supported extension was provided.
    '''
    if output_file.endswith('.xlsx'):

        work_book = XlsxWorkbook()