# Copyright © The Debusine Developers
# See the AUTHORS file at the top-level directory of this distribution
#
# This file is part of Debusine. It is subject to the license terms
# in the LICENSE file found in the top-level directory of this
# distribution. No part of Debusine, including this file, may be copied,
# modified, propagated, or distributed except according to the terms
# contained in the LICENSE file.

"""Base support for wait tasks."""

from abc import ABCMeta
from typing import override

from debusine.artifacts.models import TaskTypes, WorkRequestResults
from debusine.db.models import WorkRequest
from debusine.db.tasks import DBTask
from debusine.tasks.models import BaseDynamicTaskData, BaseTaskData


class BaseWaitTask[
    TD: BaseTaskData,
    DTD: BaseDynamicTaskData = BaseDynamicTaskData,
](DBTask[TD, DTD], metaclass=ABCMeta):
    """Base class for wait tasks."""

    TASK_TYPE = TaskTypes.WAIT

    @override
    def execute(self) -> WorkRequest.Results:
        raise AssertionError("execute called on a Wait task")

    @override
    def _execute(self) -> WorkRequestResults:
        raise AssertionError("_execute called on a Wait task")

    @override
    def get_task_configuration_subject_context(
        self,
    ) -> tuple[str | None, str | None]:
        return None, None
