# Path: clearly/utils/worker_states.py
# OFFLINE = 'OFFLINE'
# ONLINE = 'ONLINE'
# HEARTBEAT = 'HEARTBEAT'
# ALL_STATES = frozenset((OFFLINE, ONLINE, HEARTBEAT))
# TYPES = {
#     'worker-offline': OFFLINE,
#     'worker-online': ONLINE,
#     'worker-heartbeat': HEARTBEAT,
# }
# 
# Path: clearly/client/display_modes.py
# class ModeTask(EnumSpecDescription):
#     TASK = 'name, uuid, routing key, state and retries', False, False, False
# 
#     RESULT = 'TASK + results', False, True, False
#     ERROR = 'TASK + exceptions', False, False, True
#     OUTCOME = 'RESULT + ERROR', False, True, True
# 
#     SUCCESS = 'RESULT + args/kwargs', None, True, False
#     FAILURE = 'ERROR + args/kwargs', None, False, True
#     DONE = 'SUCCESS + FAILURE', None, True, True
# 
#     SENT = 'TASK + args/kwargs being sent', True, False, False
#     FLOWING = 'SENT + SUCCESS', True, True, False
#     BREAKING = 'SENT + FAILURE', True, False, True
#     ALL = 'SENT + DONE', True, True, True
# 
# class ModeWorker(EnumSpecDescription):
#     WORKER = 'name, status and pid', False
#     STATS = 'WORKER + version, load and heartbeats', True


import re
import pytest
from typing import Callable
from celery import states as task_states
from clearly.utils import worker_states
from clearly.client import ModeTask, ModeWorker




@pytest.fixture(params=sorted(task_states.ALL_STATES))
def task_state_type(request):
    yield request.param


@pytest.fixture(params=sorted(task_states.ALL_STATES.union({'?'})))
def task_state_plus_1(request):
    """Can be used for a double SUCCESS, which truncates results or not, or for a
    double PENDING, which is created or not."""
    # task results only make sense in success, so to test truncate resolving mechanism,
    # I can't just insert a bool, as almost all combinations would not make sense.
    # the same for pending.
    yield request.param


@pytest.fixture(params=sorted(task_states.ALL_STATES.union({'?1', '?2'})))
def task_state_plus_2(request):
    """Same as above, but with 2 additional states."""
    yield request.param


@pytest.fixture(params=sorted(worker_states.ALL_STATES))
def worker_state_type(request):
    yield request.param



# Path: clearly/utils/worker_states.py
# OFFLINE = 'OFFLINE'
# ONLINE = 'ONLINE'
# HEARTBEAT = 'HEARTBEAT'
# ALL_STATES = frozenset((OFFLINE, ONLINE, HEARTBEAT))
# TYPES = {
#     'worker-offline': OFFLINE,
#     'worker-online': ONLINE,
#     'worker-heartbeat': HEARTBEAT,
# }
# 
# Path: clearly/client/display_modes.py
# class ModeTask(EnumSpecDescription):
#     TASK = 'name, uuid, routing key, state and retries', False, False, False
# 
#     RESULT = 'TASK + results', False, True, False
#     ERROR = 'TASK + exceptions', False, False, True
#     OUTCOME = 'RESULT + ERROR', False, True, True
# 
#     SUCCESS = 'RESULT + args/kwargs', None, True, False
#     FAILURE = 'ERROR + args/kwargs', None, False, True
#     DONE = 'SUCCESS + FAILURE', None, True, True
# 
#     SENT = 'TASK + args/kwargs being sent', True, False, False
#     FLOWING = 'SENT + SUCCESS', True, True, False
#     BREAKING = 'SENT + FAILURE', True, False, True
#     ALL = 'SENT + DONE', True, True, True
# 
# class ModeWorker(EnumSpecDescription):
#     WORKER = 'name, status and pid', False
#     STATS = 'WORKER + version, load and heartbeats', True


# Path: tests/unit/conftest.py
import re
import pytest
from typing import Callable
from celery import states as task_states
from clearly.utils import worker_states
from clearly.client import ModeTask, ModeWorker





@pytest.fixture(params=sorted(task_states.ALL_STATES))
def task_state_type(request):
    yield request.param


@pytest.fixture(params=sorted(task_states.ALL_STATES.union({'?'})))
def task_state_plus_1(request):
    """Can be used for a double SUCCESS, which truncates results or not, or for a
    double PENDING, which is created or not."""
    # task results only make sense in success, so to test truncate resolving mechanism,
    # I can't just insert a bool, as almost all combinations would not make sense.
    # the same for pending.
    yield request.param


@pytest.fixture(params=sorted(task_states.ALL_STATES.union({'?1', '?2'})))
def task_state_plus_2(request):
    """Same as above, but with 2 additional states."""
    yield request.param


@pytest.fixture(params=sorted(worker_states.ALL_STATES))
def worker_state_type(request):
    yield request.param



@pytest.fixture(params=sorted(worker_states.TYPES.keys()))