"""Processing provider that exposes the four shoreline algorithms."""

from qgis.core import QgsProcessingProvider
from qgis.PyQt.QtGui import QIcon
import os

from .algorithms.step1_preparation import ShorelineDataPrepFinal
from .algorithms.step2_hovmoller import HovmollerUltraFinalMatch
from .algorithms.step3_zoom_stat import HovmollerStatsExtractor
from .algorithms.step4_cube import SpaceTimeCubeViewerAlg


class ShorelineProvider(QgsProcessingProvider):
    def id(self):
        return 'shoreliser'

    def name(self):
        return 'Shoreliser'

    def icon(self):
        path = os.path.join(os.path.dirname(__file__), 'icons', 'icon.svg')
        if os.path.exists(path):
            return QIcon(path)
        return QgsProcessingProvider.icon(self)

    def loadAlgorithms(self):
        self.addAlgorithm(ShorelineDataPrepFinal())
        self.addAlgorithm(HovmollerUltraFinalMatch())
        self.addAlgorithm(HovmollerStatsExtractor())
        self.addAlgorithm(SpaceTimeCubeViewerAlg())
