# Path: arq/typing.py
# WEEKDAYS = 'mon', 'tues', 'wed', 'thurs', 'fri', 'sat', 'sun'
# class WorkerCoroutine(Protocol):
# class StartupShutdown(Protocol):
# class WorkerSettingsBase(Protocol):
#     async def __call__(self, ctx: Dict[Any, Any], *args: Any, **kwargs: Any) -> Any:  # pragma: no cover
#     async def __call__(self, ctx: Dict[Any, Any]) -> Any:  # pragma: no cover
# 
# Path: arq/utils.py
# @overload
# def to_seconds(td: None) -> None:
#     pass


import asyncio
import dataclasses
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Optional, Union
from pydantic.utils import import_string
from .typing import WEEKDAYS, OptionType, SecondsTimedelta, WeekdayOptionType, WorkerCoroutine
from .utils import to_seconds
    Workers will enqueue this job at or just after the set times. If ``unique`` is true (the default) the
    job will only be run once even if multiple workers are running.

    :param coroutine: coroutine function to run
    :param name: name of the job, if None, the name of the coroutine is used
    :param month: month(s) to run the job on, 1 - 12
    :param day: day(s) to run the job on, 1 - 31
    :param weekday: week day(s) to run the job on, 0 - 6 or mon - sun
    :param hour: hour(s) to run the job on, 0 - 23
    :param minute: minute(s) to run the job on, 0 - 59
    :param second: second(s) to run the job on, 0 - 59
    :param microsecond: microsecond(s) to run the job on,
        defaults to 123456 as the world is busier at the top of a second, 0 - 1e6
    :param run_at_startup: whether to run as worker starts
    :param unique: whether the job should only be executed once at each time (useful if you have multiple workers)
    :param job_id: ID of the job, can be used to enforce job uniqueness, spanning multiple cron schedules
    :param timeout: job timeout
    :param keep_result: how long to keep the result for
    :param keep_result_forever: whether to keep results forever
    :param max_tries: maximum number of tries for the job
    """

    if isinstance(coroutine, str):
        name = name or 'cron:' + coroutine
        coroutine_: WorkerCoroutine = import_string(coroutine)
    else:
        coroutine_ = coroutine

    assert asyncio.iscoroutinefunction(coroutine_), f'{coroutine_} is not a coroutine function'
    timeout = to_seconds(timeout)

# Path: arq/typing.py
# WEEKDAYS = 'mon', 'tues', 'wed', 'thurs', 'fri', 'sat', 'sun'
# class WorkerCoroutine(Protocol):
# class StartupShutdown(Protocol):
# class WorkerSettingsBase(Protocol):
#     async def __call__(self, ctx: Dict[Any, Any], *args: Any, **kwargs: Any) -> Any:  # pragma: no cover
#     async def __call__(self, ctx: Dict[Any, Any]) -> Any:  # pragma: no cover
# 
# Path: arq/utils.py
# @overload
# def to_seconds(td: None) -> None:
#     pass


# Path: arq/cron.py
import asyncio
import dataclasses
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Optional, Union
from pydantic.utils import import_string
from .typing import WEEKDAYS, OptionType, SecondsTimedelta, WeekdayOptionType, WorkerCoroutine
from .utils import to_seconds

    Workers will enqueue this job at or just after the set times. If ``unique`` is true (the default) the
    job will only be run once even if multiple workers are running.

    :param coroutine: coroutine function to run
    :param name: name of the job, if None, the name of the coroutine is used
    :param month: month(s) to run the job on, 1 - 12
    :param day: day(s) to run the job on, 1 - 31
    :param weekday: week day(s) to run the job on, 0 - 6 or mon - sun
    :param hour: hour(s) to run the job on, 0 - 23
    :param minute: minute(s) to run the job on, 0 - 59
    :param second: second(s) to run the job on, 0 - 59
    :param microsecond: microsecond(s) to run the job on,
        defaults to 123456 as the world is busier at the top of a second, 0 - 1e6
    :param run_at_startup: whether to run as worker starts
    :param unique: whether the job should only be executed once at each time (useful if you have multiple workers)
    :param job_id: ID of the job, can be used to enforce job uniqueness, spanning multiple cron schedules
    :param timeout: job timeout
    :param keep_result: how long to keep the result for
    :param keep_result_forever: whether to keep results forever
    :param max_tries: maximum number of tries for the job
    """

    if isinstance(coroutine, str):
        name = name or 'cron:' + coroutine
        coroutine_: WorkerCoroutine = import_string(coroutine)
    else:
        coroutine_ = coroutine

    assert asyncio.iscoroutinefunction(coroutine_), f'{coroutine_} is not a coroutine function'
    timeout = to_seconds(timeout)

    keep_result = to_seconds(keep_result)