# Copyright Swiss Data Science Center (SDSC). A partnership between
# École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Define classes for converting workflows to workflow languages."""

from __future__ import annotations

from abc import ABCMeta, abstractmethod
from pathlib import Path
from typing import List, Optional, Tuple

from renku.domain_model.workflow.plan import AbstractPlan


class IWorkflowConverter(metaclass=ABCMeta):
    """Abstract class for converting ``Plan`` to a workflow format."""

    @abstractmethod
    def workflow_format(self) -> Tuple[IWorkflowConverter, List[str]]:
        """Supported workflow description formats."""
        pass

    @abstractmethod
    def workflow_convert(
        self, workflow: AbstractPlan, basedir: Path, output: Optional[Path], output_format: Optional[str]
    ) -> str:
        """Converts a single workflow step to a desired workflow format."""
        pass
