"""
Code generated by `q.pipelines`
- Timestamp: 2024-05-06 15:36:44.816930
- Input file: "backend/game-preprocess/src/moveread/pipelines/game_preprocess/spec.py"
- Input spec: Tasks({
  'input_task': 'preinput',
  'Input': moveread.pipelines.game_preprocess.spec.Input,  # class
  'Output': moveread.pipelines.game_preprocess.spec.Result,  # class
  'tasks': {
    'preinput': Task(Input -> preprocess),
    'preprocess': Task(PreInput -> join),
    'join': Task(PreResult -> output)
  }
})
"""
from typing import Literal, TypedDict, Union, overload, TypeAlias
from q.api import ReadQueue, WriteQueue
from q.pipelines import TaskQueues, Pipeline
from ..spec import Input, PreInput, PreResult, Result


class Preinput:
  In = Input
  Out = Union[
    tuple[Literal['preprocess'], PreInput],
  ] # type: ignore
  QueueIn = ReadQueue[In]
  QueueOut = WriteQueue[Out]
  Queues = TaskQueues[In, Out]

  @classmethod
  @overload
  def next(cls, task: Literal['preprocess'], data: PreInput) -> 'Preinput.Out': ... # type: ignore
  @classmethod
  def next(cls, task, data):
    return task, data

class Preprocess:
  In = PreInput
  Out = Union[
    tuple[Literal['join'], PreResult],
  ] # type: ignore
  QueueIn = ReadQueue[In]
  QueueOut = WriteQueue[Out]
  Queues = TaskQueues[In, Out]

  @classmethod
  @overload
  def next(cls, task: Literal['join'], data: PreResult) -> 'Preprocess.Out': ... # type: ignore
  @classmethod
  def next(cls, task, data):
    return task, data

class Join:
  In = PreResult
  Out = Union[
    tuple[Literal['output'], Result],
  ] # type: ignore
  QueueIn = ReadQueue[In]
  QueueOut = WriteQueue[Out]
  Queues = TaskQueues[In, Out]

  @classmethod
  @overload
  def next(cls, task: Literal['output'], data: Result) -> 'Join.Out': ... # type: ignore
  @classmethod
  def next(cls, task, data):
    return task, data

class Queues(TypedDict):
  preinput: TaskQueues[Preinput.In, Preinput.Out]
  preprocess: TaskQueues[Preprocess.In, Preprocess.Out]
  join: TaskQueues[Join.In, Join.Out]

class Pipelines(TypedDict):
  preinput: Pipeline[Preinput.In, Preinput.Out]
  preprocess: Pipeline[Preprocess.In, Preprocess.Out]
  join: Pipeline[Join.In, Join.Out]

QueueIn: TypeAlias = ReadQueue[Input]
QueueOut: TypeAlias = WriteQueue[Result]

__all__ = [
  'Preinput',
  'Preprocess',
  'Join',
  'Queues', 'Pipelines', 'QueueIn', 'QueueOut',
]