import typing, abc
from System import Guid, ValueTuple_2, Predicate_1, MulticastDelegate, IAsyncResult, AsyncCallback
from System.IO import FileInfo, DirectoryInfo
from SIMULTAN.Projects.ManagedFiles import ManagedFileCollection, ManagedFile
from System.Collections.Generic import IEnumerable_1, List_1, IReadOnlyList_1, Dictionary_2
from System.ComponentModel import ISynchronizeInvoke
from SIMULTAN.Utils import IDispatcherTimerFactory
from SIMULTAN.Data.Assets import AssetManager, MultiLinkManager, ResourceFileEntry, ResourceLocationError, ResourceEntry, ResourceDirectoryEntry, LinkedResourceFileEntry, ContainedResourceFileEntry
from SIMULTAN.Exchange import ComponentGeometryExchange
from SIMULTAN.Data.Components import SimComponentCollection, ParameterFactory, SimUserComponentListCollection, SimCalculation, SimComponent, SimBaseParameter
from SIMULTAN.DataMapping import SimDataMappingToolCollection
from SIMULTAN.Data.Geometry import SimGeometryModelCollection, SimGeometryRelationCollection
from SIMULTAN.Data import SimIdGenerator, IReferenceLocation
from SIMULTAN.Data.FlowNetworks import SimNetworkFactory
from SIMULTAN.Data.SimNetworks import SimNetwork
from SIMULTAN.Data.SitePlanner import SitePlannerManager
from SIMULTAN.Data.Taxonomy import SimTaxonomyCollection
from SIMULTAN.Data.Users import SimUsersManager, SimUser
from SIMULTAN.Data.MultiValues import SimMultiValueCollection, SimMultiValue
from SIMULTAN.Data.ValueMappings import SimValueMappingCollection
from System.Collections.ObjectModel import ObservableCollection_1
from System.Reflection import MethodInfo

class CompactProject(HierarchicalProject):
    def __init__(self, id: Guid, _project_file: FileInfo, _all_managers: ExtendedProjectData, _files: ManagedFileCollection, _non_managed_files: IEnumerable_1[FileInfo], _contained_dirs: IEnumerable_1[DirectoryInfo], _associated_files: IEnumerable_1[FileInfo], _unpack_folder: DirectoryInfo) -> None: ...
    @property
    def AllProjectDataManagers(self) -> ExtendedProjectData: ...
    @AllProjectDataManagers.setter
    def AllProjectDataManagers(self, value: ExtendedProjectData) -> ExtendedProjectData: ...
    @property
    def AssociatedFilesCount(self) -> int: ...
    @property
    def AuthenticationSkipped(self) -> bool: ...
    @AuthenticationSkipped.setter
    def AuthenticationSkipped(self, value: bool) -> bool: ...
    @property
    def Children(self) -> HierarchicalProject.ChildProjectCollection: ...
    @property
    def ContainedDirectoriesCopy(self) -> List_1[DirectoryInfo]: ...
    @property
    def ContainsUnsavedChanges(self) -> bool: ...
    @ContainsUnsavedChanges.setter
    def ContainsUnsavedChanges(self, value: bool) -> bool: ...
    @property
    def GlobalID(self) -> Guid: ...
    @property
    def IsAuthenticated(self) -> bool: ...
    @property
    def IsLoaded(self) -> bool: ...
    @property
    def IsOpened(self) -> bool: ...
    @property
    def IsReadyForAuthentication(self) -> bool: ...
    @property
    def ManagedFiles(self) -> ManagedFileCollection: ...
    @ManagedFiles.setter
    def ManagedFiles(self, value: ManagedFileCollection) -> ManagedFileCollection: ...
    @property
    def Name(self) -> str: ...
    @property
    def NonManagedFiles(self) -> IReadOnlyList_1[FileInfo]: ...
    @property
    def ParentProjects(self) -> IReadOnlyList_1[HierarchicalProject]: ...
    @property
    def ProjectFile(self) -> FileInfo: ...
    @property
    def ProjectUnpackFolder(self) -> DirectoryInfo: ...
    @ProjectUnpackFolder.setter
    def ProjectUnpackFolder(self, value: DirectoryInfo) -> DirectoryInfo: ...
    def UpdateBackupFile(self) -> None: ...


class ExtendedProjectData(ProjectData):
    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, synchronizationContext: ISynchronizeInvoke, dispatcherTimer: IDispatcherTimerFactory) -> None: ...
    @property
    def AssetManager(self) -> AssetManager: ...
    @property
    def ComponentGeometryExchange(self) -> ComponentGeometryExchange: ...
    @property
    def Components(self) -> SimComponentCollection: ...
    @property
    def DataMappingTools(self) -> SimDataMappingToolCollection: ...
    @property
    def DispatcherTimerFactory(self) -> IDispatcherTimerFactory: ...
    @DispatcherTimerFactory.setter
    def DispatcherTimerFactory(self, value: IDispatcherTimerFactory) -> IDispatcherTimerFactory: ...
    @property
    def GeometryModels(self) -> SimGeometryModelCollection: ...
    @property
    def GeometryRelations(self) -> SimGeometryRelationCollection: ...
    @property
    def IdGenerator(self) -> SimIdGenerator: ...
    @property
    def ImportLogFile(self) -> FileInfo: ...
    @ImportLogFile.setter
    def ImportLogFile(self, value: FileInfo) -> FileInfo: ...
    @property
    def MultiLinkManager(self) -> MultiLinkManager: ...
    @property
    def NetworkManager(self) -> SimNetworkFactory: ...
    @property
    def Owner(self) -> IReferenceLocation: ...
    @Owner.setter
    def Owner(self, value: IReferenceLocation) -> IReferenceLocation: ...
    @property
    def ParameterLibraryManager(self) -> ParameterFactory: ...
    @property
    def Project(self) -> HierarchicalProject: ...
    @Project.setter
    def Project(self, value: HierarchicalProject) -> HierarchicalProject: ...
    @property
    def SimNetworks(self) -> SimNetwork.SimNetworkCollection: ...
    @property
    def SitePlannerManager(self) -> SitePlannerManager: ...
    @property
    def SynchronizationContext(self) -> ISynchronizeInvoke: ...
    @SynchronizationContext.setter
    def SynchronizationContext(self, value: ISynchronizeInvoke) -> ISynchronizeInvoke: ...
    @property
    def Taxonomies(self) -> SimTaxonomyCollection: ...
    @property
    def UserComponentLists(self) -> SimUserComponentListCollection: ...
    @property
    def UsersManager(self) -> SimUsersManager: ...
    @property
    def ValueManager(self) -> SimMultiValueCollection: ...
    @property
    def ValueMappings(self) -> SimValueMappingCollection: ...
    def Reset(self) -> None: ...


class HierarchicalProject(IReferenceLocation, abc.ABC):
    @property
    def AllProjectDataManagers(self) -> ExtendedProjectData: ...
    @AllProjectDataManagers.setter
    def AllProjectDataManagers(self, value: ExtendedProjectData) -> ExtendedProjectData: ...
    @property
    def AssociatedFilesCount(self) -> int: ...
    @property
    def AuthenticationSkipped(self) -> bool: ...
    @AuthenticationSkipped.setter
    def AuthenticationSkipped(self, value: bool) -> bool: ...
    @property
    def Children(self) -> HierarchicalProject.ChildProjectCollection: ...
    @property
    def ContainedDirectoriesCopy(self) -> List_1[DirectoryInfo]: ...
    @property
    def ContainsUnsavedChanges(self) -> bool: ...
    @ContainsUnsavedChanges.setter
    def ContainsUnsavedChanges(self, value: bool) -> bool: ...
    @property
    def GlobalID(self) -> Guid: ...
    @property
    def IsAuthenticated(self) -> bool: ...
    @IsAuthenticated.setter
    def IsAuthenticated(self, value: bool) -> bool: ...
    @property
    def IsLoaded(self) -> bool: ...
    @IsLoaded.setter
    def IsLoaded(self, value: bool) -> bool: ...
    @property
    def IsOpened(self) -> bool: ...
    @IsOpened.setter
    def IsOpened(self, value: bool) -> bool: ...
    @property
    def IsReadyForAuthentication(self) -> bool: ...
    @IsReadyForAuthentication.setter
    def IsReadyForAuthentication(self, value: bool) -> bool: ...
    @property
    def ManagedFiles(self) -> ManagedFileCollection: ...
    @ManagedFiles.setter
    def ManagedFiles(self, value: ManagedFileCollection) -> ManagedFileCollection: ...
    @property
    def Name(self) -> str: ...
    @property
    def NonManagedFiles(self) -> IReadOnlyList_1[FileInfo]: ...
    @property
    def ParentProjects(self) -> IReadOnlyList_1[HierarchicalProject]: ...
    @property
    def ProjectUnpackFolder(self) -> DirectoryInfo: ...
    @ProjectUnpackFolder.setter
    def ProjectUnpackFolder(self, value: DirectoryInfo) -> DirectoryInfo: ...
    def AddEmptyGeoMapResource(self, _target: DirectoryInfo, _initial_file_name: str, nameCollisionFormat: str) -> ResourceFileEntry: ...
    def AddEmptyGeometryResource(self, _target: DirectoryInfo, _initial_file_name: str, nameCollisionFormat: str, dispatcherTimer: IDispatcherTimerFactory) -> ResourceFileEntry: ...
    def AddEmptyGeometryResourceWithoutCollisionCheck(self, _target: DirectoryInfo, file_name: str) -> ResourceFileEntry: ...
    def AddEmptyResource(self, file: FileInfo) -> ResourceFileEntry: ...
    def AddEmptySitePlannerResource(self, _target: DirectoryInfo, _initial_file_name: str, nameCollisionFormat: str) -> ResourceFileEntry: ...
    def AddResourceFile(self, file: FileInfo, projectDataManager: ExtendedProjectData) -> None: ...
    def AddUndifferentiated(self, _files: IEnumerable_1[FileInfo]) -> None: ...
    def CanLinkAsResource(self, _file: FileInfo) -> ResourceLocationError: ...
    def CanMoveResourceEntry(self, _resource: ResourceEntry, _target: ResourceDirectoryEntry, nameCollisionFormat: str) -> ValueTuple_2[bool, str]: ...
    def CanRenameResourceEntry(self, _resource: ResourceEntry, _name: str, nameCollisionFormat: str, _name_is_full_name: bool = ...) -> ValueTuple_2[bool, str]: ...
    def ContainedToLinked(self, _original: ContainedResourceFileEntry, _target_folder: DirectoryInfo, copyNameFormat: str) -> LinkedResourceFileEntry: ...
    def CopyResource(self, source: ResourceEntry, _target: ResourceDirectoryEntry, nameCollisionFormat: str, newOwner: SimUser = ...) -> None: ...
    def CopyResourceAsContainedFileEntry(self, file: FileInfo, targetDir: DirectoryInfo, copyNameFormat: str) -> ResourceEntry: ...
    def CreateResourceDirIn(self, _dir_name: str, _target_dir: DirectoryInfo, collisionNameFormat: str) -> ResourceEntry: ...
    def DeleteResource(self, _resource_to_delete: ResourceEntry) -> ValueTuple_2[bool, bool]: ...
    def DisableProjectUnpackFolderWatcher(self) -> None: ...
    def EnableProjectUnpackFolderWatcher(self) -> None: ...
    def FindProjects(self, predicate: Predicate_1[HierarchicalProject]) -> IEnumerable_1[HierarchicalProject]: ...
    def GetAssociatedFiles(self) -> None: ...
    def GetCorresponding(self, _resource: ResourceEntry) -> ManagedFile: ...
    def LinkedToContained(self, _original: LinkedResourceFileEntry, nameFormat: str) -> ContainedResourceFileEntry: ...
    def LinkResourceFile(self, _file: FileInfo, _target_dir: DirectoryInfo, _allow_duplicates: bool) -> ValueTuple_2[ResourceEntry, bool]: ...
    @staticmethod
    def LoadDefaultTaxonomies(projectData: ExtendedProjectData) -> bool: ...
    def MoveResourceEntry(self, _resource: ResourceEntry, _target: ResourceDirectoryEntry, nameCollisionFormat: str, _check_admissibility: bool) -> None: ...
    def OnFileImportTimeout(self, file: FileInfo) -> None: ...
    def OnProjectAuthenticated(self, _successfully: bool) -> None: ...
    def OnProjectClosed(self) -> None: ...
    def OnProjectLoaded(self) -> None: ...
    def OnProjectOpened(self) -> None: ...
    def OnProjectReadyForAuthentication(self) -> None: ...
    def OnProjectUnloaded(self) -> None: ...
    def OnProjectUpToDateChanged(self, isUpToDate: bool) -> None: ...
    def PassNonManagedAndAllDirs(self, _non_managed_files: IEnumerable_1[FileInfo], _contained_dirs: IEnumerable_1[DirectoryInfo]) -> None: ...
    def RenameResourceEntry(self, _resource: ResourceEntry, _name: str, nameCollisionFormat: str) -> None: ...
    def ReplaceLinkedResource(self, _resource: ResourceEntry, _new_file: FileInfo, _allow_duplicates: bool) -> bool: ...
    def ReplaceManagedFiles(self, _old_files: IEnumerable_1[FileInfo], _new_files: IEnumerable_1[FileInfo]) -> None: ...
    def ResetNonManaged(self) -> None: ...
    # Skipped IsInProject due to it being static, abstract and generic.

    IsInProject : IsInProject_MethodGroup
    class IsInProject_MethodGroup:
        @typing.overload
        def __call__(self, _calculation: SimCalculation) -> bool:...
        @typing.overload
        def __call__(self, _component: SimComponent) -> bool:...
        @typing.overload
        def __call__(self, multiValue: SimMultiValue) -> bool:...
        @typing.overload
        def __call__(self, _parameter: SimBaseParameter) -> bool:...
        @typing.overload
        def __call__(self, resource: ResourceEntry) -> bool:...


    class ChildProjectCollection(ObservableCollection_1[HierarchicalProject]):
        def __init__(self, owner: HierarchicalProject) -> None: ...
        @property
        def Count(self) -> int: ...
        @property
        def Item(self) -> HierarchicalProject: ...
        @Item.setter
        def Item(self, value: HierarchicalProject) -> HierarchicalProject: ...


    class FileImportTimeoutEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, file: FileInfo, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any, file: FileInfo) -> None: ...


    class ProjectAuthenticatedEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any) -> None: ...


    class ProjectClosedEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any) -> None: ...


    class ProjectLoadedEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any) -> None: ...


    class ProjectOpenedEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any) -> None: ...


    class ProjectReadyForAuthenticationEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any) -> None: ...


    class ProjectUnloadedEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any) -> None: ...


    class ProjectUpToDateChangedEventHandler(MulticastDelegate):
        def __init__(self, object: typing.Any, method: int) -> None: ...
        @property
        def Method(self) -> MethodInfo: ...
        @property
        def Target(self) -> typing.Any: ...
        def BeginInvoke(self, sender: typing.Any, isUpToDate: bool, callback: AsyncCallback, object: typing.Any) -> IAsyncResult: ...
        def EndInvoke(self, result: IAsyncResult) -> None: ...
        def Invoke(self, sender: typing.Any, isUpToDate: bool) -> None: ...



class HierarchicProjectMetaData:
    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, _project_id: Guid, _children: Dictionary_2[Guid, str]) -> None: ...
    @typing.overload
    def __init__(self, original: HierarchicProjectMetaData) -> None: ...
    @property
    def ChildProjects(self) -> Dictionary_2[Guid, str]: ...
    @property
    def ProjectId(self) -> Guid: ...
    def AddChildProject(self, _project_id: Guid, _project_folder: DirectoryInfo, _child_project_folder: DirectoryInfo) -> None: ...
    def RemoveChildProject(self, _project_id: Guid) -> None: ...


class ProjectData(abc.ABC):
    def __init__(self, synchronizationContext: ISynchronizeInvoke, dispatcherTimer: IDispatcherTimerFactory) -> None: ...
    @property
    def AssetManager(self) -> AssetManager: ...
    @property
    def ComponentGeometryExchange(self) -> ComponentGeometryExchange: ...
    @property
    def Components(self) -> SimComponentCollection: ...
    @property
    def DataMappingTools(self) -> SimDataMappingToolCollection: ...
    @property
    def DispatcherTimerFactory(self) -> IDispatcherTimerFactory: ...
    @DispatcherTimerFactory.setter
    def DispatcherTimerFactory(self, value: IDispatcherTimerFactory) -> IDispatcherTimerFactory: ...
    @property
    def GeometryModels(self) -> SimGeometryModelCollection: ...
    @property
    def GeometryRelations(self) -> SimGeometryRelationCollection: ...
    @property
    def IdGenerator(self) -> SimIdGenerator: ...
    @property
    def ImportLogFile(self) -> FileInfo: ...
    @ImportLogFile.setter
    def ImportLogFile(self, value: FileInfo) -> FileInfo: ...
    @property
    def MultiLinkManager(self) -> MultiLinkManager: ...
    @property
    def NetworkManager(self) -> SimNetworkFactory: ...
    @property
    def Owner(self) -> IReferenceLocation: ...
    @Owner.setter
    def Owner(self, value: IReferenceLocation) -> IReferenceLocation: ...
    @property
    def ParameterLibraryManager(self) -> ParameterFactory: ...
    @property
    def SimNetworks(self) -> SimNetwork.SimNetworkCollection: ...
    @property
    def SitePlannerManager(self) -> SitePlannerManager: ...
    @property
    def SynchronizationContext(self) -> ISynchronizeInvoke: ...
    @SynchronizationContext.setter
    def SynchronizationContext(self, value: ISynchronizeInvoke) -> ISynchronizeInvoke: ...
    @property
    def Taxonomies(self) -> SimTaxonomyCollection: ...
    @property
    def UserComponentLists(self) -> SimUserComponentListCollection: ...
    @property
    def UsersManager(self) -> SimUsersManager: ...
    @property
    def ValueManager(self) -> SimMultiValueCollection: ...
    @property
    def ValueMappings(self) -> SimValueMappingCollection: ...
    def Clear(self) -> None: ...
    def RestoreDefaultTaxonomyReferences(self, taxonomyFileVersion: int = ...) -> None: ...
    def SetCallingLocation(self, caller: IReferenceLocation) -> None: ...


class ResourceReference:
    @typing.overload
    def __init__(self, projectId: Guid, res: ResourceFileEntry) -> None: ...
    @typing.overload
    def __init__(self, projectId: Guid, resourceIndex: int) -> None: ...
    @typing.overload
    def __init__(self, projectId: Guid, resourceIndex: int, assetManager: AssetManager) -> None: ...
    @property
    def Exists(self) -> bool: ...
    @property
    def ProjectId(self) -> Guid: ...
    @ProjectId.setter
    def ProjectId(self, value: Guid) -> Guid: ...
    @property
    def ResourceFile(self) -> ResourceFileEntry: ...
    @ResourceFile.setter
    def ResourceFile(self, value: ResourceFileEntry) -> ResourceFileEntry: ...
    @property
    def ResourceIndex(self) -> int: ...
    @ResourceIndex.setter
    def ResourceIndex(self, value: int) -> int: ...
    def Equals(self, obj: typing.Any) -> bool: ...
    def GetHashCode(self) -> int: ...
    def LazyLoad(self, assetManager: AssetManager) -> None: ...

