# import importDAE
import Mesh
import FreeCAD as App
from model.files_generator import FolderGenerator
from helper.is_solid import is_object_solid
from enum import Enum


class EXPORT_TYPES(Enum):
    STL = "STL"
    DAO = "DAO"
    OBJ = "OBJ"


class ExportUseCase:
    def call(path: str, type: EXPORT_TYPES):
        meshes = {}
        for el in App.ActiveDocument.Objects:
            if is_object_solid(el):
                match type.value:
                    case EXPORT_TYPES.OBJ.value:
                        import importOBJ

                        importOBJ.export(
                            [el],
                            path
                            + FolderGenerator.MESHES.value
                            + "/"
                            + el.Label
                            + ".obj",
                        )
                        meshes[el.Label] = (
                            "/" + FolderGenerator.MESHES.value + "/" + el.Label + ".obj"
                        )
        return meshes
