# Generated by sila2.code_generator; sila2.__version__: 0.10.3
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING

from sila2.server import FeatureImplementationBase, MetadataDict

from .cancelcontroller_types import UUID, CancelAll_Responses, CancelCommand_Responses

if TYPE_CHECKING:

    from ...server import Server


class CancelControllerBase(FeatureImplementationBase, ABC):
    parent_server: Server

    def __init__(self, parent_server: Server):
        """
            This feature offers commands to cancel/terminate Commands. Cancellation is the act of stopping the running Command execution(s),
        irrevocably. The SiLA Server SHOULD be able to be in a state where any further
        commands can be issued after a cancellation.
        """
        super().__init__(parent_server=parent_server)

    @abstractmethod
    def CancelCommand(self, CommandExecutionUUID: UUID, *, metadata: MetadataDict) -> CancelCommand_Responses:
        """
          Cancel a specified currently running Observable Command or cancel all currently running Observable Commands .
        For any canceled Observable Command the SiLA Server MUST update the Command Execution Status to "Command Finished
        with Error".
        The SiLA Server MUST throw a descriptive error message indicating cancellation as the reason for the Command
        execution not being able to finish successfully for any canceled Command.


          :param CommandExecutionUUID: The Command Execution UUID according to the SiLA Standard.

          :param metadata: The SiLA Client Metadata attached to the call

        """
        pass

    @abstractmethod
    def CancelAll(self, *, metadata: MetadataDict) -> CancelAll_Responses:
        """
          Cancels all currently running Observable and Unobservable Commands running on this SiLA Server.
        The SiLA Server MUST throw an Execution Error indicating 'cancellation' as the reason for the
        Command not being able to finish successfully.


          :param metadata: The SiLA Client Metadata attached to the call

        """
        pass
