#!/usr/bin/env python3
"""

"""

# Imports:
from __future__ import annotations

# ##-- stdlib imports
import datetime
import enum
import functools as ftz
import itertools as itz
import logging as logmod
import pathlib as pl
import re
import time
import types
import weakref
from typing import (TYPE_CHECKING, Any, Callable, ClassVar, Final, Generator,
                    Generic, Iterable, Iterator, Mapping, Match,
                    MutableMapping, Protocol, Sequence, Tuple, TypeAlias,
                    TypeGuard, TypeVar, cast, final, overload,
                    runtime_checkable)
from uuid import UUID, uuid1

# ##-- end stdlib imports

# ##-- 1st party imports
import doot
import doot.errors
from doot.structs import ActionSpec
from doot.task.core.task import DootTask

# ##-- end 1st party imports

##-- logging
logging = logmod.getLogger(__name__)
printer = doot.subprinter()
##-- end logging

class SimpleTaskExample(DootTask):
    """
      A Simple example task
    """

    def __init__(self, spec, *, job=None, action_ctor=None, **kwargs):
        super().__init__(spec, job=job, **kwargs)
        self._extra_actions = []
        self._extra_actions.append(ActionSpec(do="custom head", fun=self._head))
        self._extra_actions.append(ActionSpec(do="custom tail", fun=self._tail))

    @property
    def actions(self):
        """ yield spec actions, plus a head and tail """
        yield self._extra_actions[0]
        yield from iter(self.spec.actions)
        yield self._extra_actions[1]

    def _head(self, spec, state):
        printer.info("An Example Head action")

    def _tail(self, spec, state):
        printer.info("An Example Tail Action")
