from typing import Tuple, Set, Iterable, List


class IExternalServer:
    def GetServerId(self) -> Guid: ...
    def GetServiceId(self) -> ExternalServiceId: ...
    def GetName(self) -> str: ...
    def GetVendorId(self) -> str: ...
    def GetDescription(self) -> str: ...


class IExternalData:


class ExternalServiceOptions:
    def __init__(self): ...
    @property
    def IsPublic(self) -> bool: ...
    @IsPublic.setter
    def IsPublic(self, isPublic: bool) -> None: ...
    @property
    def IsRecordable(self) -> bool: ...
    @IsRecordable.setter
    def IsRecordable(self, isRecordable: bool) -> None: ...
    @property
    def IsSelfsynchronizing(self) -> bool: ...
    @IsSelfsynchronizing.setter
    def IsSelfsynchronizing(self, isSelfsynchronizing: bool) -> None: ...
    @property
    def IsValidObject(self) -> bool: ...
    def Dispose(self) -> None: ...


class ExternalService:
    @property
    def ServiceId(self) -> ExternalServiceId: ...
    @property
    def Name(self) -> str: ...
    @property
    def Description(self) -> str: ...
    @property
    def VendorId(self) -> str: ...
    @property
    def IsSerializable(self) -> bool: ...
    @property
    def NumberOfServers(self) -> int: ...
    @property
    def IsValidObject(self) -> bool: ...
    def GetOptions(self) -> ExternalServiceOptions: ...
    def GetPublicAccessKey(self) -> Guid: ...
    def AddServer(self, server: IExternalServer) -> None: ...
    def RemoveServer(self, serverId: Guid) -> None: ...
    def GetServer(self, serverId: Guid) -> IExternalServer: ...
    def GetDefaultServerId(self) -> Guid: ...
    def GetRegisteredServerIds(self) -> List[Guid]: ...
    def IsRegisteredServerId(self, serverId: Guid) -> bool: ...
    def Dispose(self) -> None: ...


class ExternalServiceId(GuidEnum):
    def __init__(self, guid: Guid): ...
    def op_Equality(first: ExternalServiceId, second: ExternalServiceId) -> bool: ...
    def op_Inequality(first: ExternalServiceId, second: ExternalServiceId) -> bool: ...


class ExternalServices:


class BuiltInExternalServices:
    @property
    def ATFTranslationService() -> ExternalServiceId: ...
    @property
    def AlignmentService() -> ExternalServiceId: ...
    @property
    def CloudExternalService() -> ExternalServiceId: ...
    @property
    def CodeCheckingParameterService() -> ExternalServiceId: ...
    @property
    def ConnectionTypeChangedService() -> ExternalServiceId: ...
    @property
    def DirectContext3DService() -> ExternalServiceId: ...
    @property
    def DuctFittingAndAccessoryPressureDropService() -> ExternalServiceId: ...
    @property
    def DuctFittingAndAccessoryPressureDropUIService() -> ExternalServiceId: ...
    @property
    def DuctPressureDropService() -> ExternalServiceId: ...
    @property
    def EntitlementExternalService() -> ExternalServiceId: ...
    @property
    def ExternalResourceService() -> ExternalServiceId: ...
    @property
    def ExternalResourceUIService() -> ExternalServiceId: ...
    @property
    def FramingProfileService() -> ExternalServiceId: ...
    @property
    def HoleDefinitionService() -> ExternalServiceId: ...
    @property
    def IFCExporterService() -> ExternalServiceId: ...
    @property
    def IFCImporterService() -> ExternalServiceId: ...
    @property
    def MemberForcesService() -> ExternalServiceId: ...
    @property
    def ModifyConnectionParametersService() -> ExternalServiceId: ...
    @property
    def NavisworksExporterService() -> ExternalServiceId: ...
    @property
    def PathOfTravelCalculationService() -> ExternalServiceId: ...
    @property
    def PipeFittingAndAccessoryPressureDropService() -> ExternalServiceId: ...
    @property
    def PipeFittingAndAccessoryPressureDropUIService() -> ExternalServiceId: ...
    @property
    def PipeFrictionFactorService() -> ExternalServiceId: ...
    @property
    def PipePlumbingFixtureFlowService() -> ExternalServiceId: ...
    @property
    def PipePressureDropService() -> ExternalServiceId: ...
    @property
    def RebarUpdateService() -> ExternalServiceId: ...
    @property
    def SiteInsertService() -> ExternalServiceId: ...
    @property
    def SiteLinkerUIService() -> ExternalServiceId: ...
    @property
    def SnappingService() -> ExternalServiceId: ...
    @property
    def StructuralSectionsService() -> ExternalServiceId: ...


class ExternalServiceRegistry:
    @overload
    def RegisterService(service: ISingleServerService, defaultServerId: Guid, options: ExternalServiceOptions) -> Guid: ...
    @overload
    def RegisterService(service: IMultiServerService, options: ExternalServiceOptions, policy: ExecutionPolicy) -> Guid: ...
    @overload
    def RegisterService(service: ISingleServerService, options: ExternalServiceOptions) -> Guid: ...
    def GetService(serviceId: ExternalServiceId) -> ExternalService: ...
    def GetServices() -> List[ExternalService]: ...
    @overload
    def ExecuteService(executionKey: Guid, serverId: Guid, data: IExternalData) -> ExternalServiceResult: ...
    @overload
    def ExecuteService(executionKey: Guid, document: Document, data: IExternalData) -> ExternalServiceResult: ...
    @overload
    def ExecuteService(executionKey: Guid, data: IExternalData) -> ExternalServiceResult: ...


class IExternalService:
    def GetServiceId(self) -> ExternalServiceId: ...
    def GetName(self) -> str: ...
    def GetVendorId(self) -> str: ...
    def GetDescription(self) -> str: ...
    def IsValidServer(self, server: IExternalServer) -> bool: ...
    def Execute(self, server: IExternalServer, document: Document, data: IExternalData) -> bool: ...
    def OnServersDisparity(self, document: Document, oldServers: List[Guid]) -> DisparityResponse: ...
    def OnServersChanged(self, document: Document, cause: ServerChangeCause, oldServers: List[Guid]) -> None: ...


class IMultiServerService:
    def CanExecute(self, server: IExternalServer, document: Document, data: IExternalData) -> bool: ...


class ISingleServerService:


class ServerChangeCause:
    ImposedChange = 0
    UserChange = 1


class ExternalServiceResult:
    Succeeded = 0
    Failed = 1
    Unhandled = 2


class ExecutionPolicy:
    FirstApplicableServer = 0
    AllApplicableServers = 1


class DisparityResponse:
    DoNothing = 0
    ApplyDefaults = 1
    LetUserDecide = 2


class MultiServerService(ExternalService):
    @property
    def ExecutionPolicy(self) -> ExecutionPolicy: ...
    @overload
    def GetActiveServerIds(self, document: Document) -> List[Guid]: ...
    @overload
    def GetActiveServerIds(self) -> List[Guid]: ...
    @overload
    def SetActiveServers(self, serverIds: List[Guid], document: Document) -> None: ...
    @overload
    def SetActiveServers(self, serverIds: List[Guid]) -> None: ...


class SingleServerService(ExternalService):
    @overload
    def GetActiveServerId(self, document: Document) -> Guid: ...
    @overload
    def GetActiveServerId(self) -> Guid: ...
    @overload
    def SetActiveServer(self, serverId: Guid, document: Document) -> None: ...
    @overload
    def SetActiveServer(self, serverId: Guid) -> None: ...
    def UnsetActiveServer(self, document: Document) -> None: ...
