# Path: pq/utils/serializers.py
# def serializer(cls):
#     def __new__(cls, name, bases, attrs):
#     def consumer(cls):
#     def get(self, name):
#     def tojson(self):
#     def __init__(self, *args, **kwargs):
#     def decode(cls, data):
#     def encode(cls, message):
#         def decode(cls, data):
#         def encode(cls, message):
# def queue_message(d, type=None):
#     def default(self, o):
# def as_message(o):
# class MessageMetaClass(type):
# class Message(metaclass=MessageMetaClass):
# class MessageDict(Message):
# class Json:
#     class MsgPack:
# class JSONEncoder(json.JSONEncoder):


from pulsar.api import Setting
from pulsar.utils.config import (
    validate_list, validate_bool, validate_pos_float
)
from pulsar.utils.importer import module_attribute
from ..utils.serializers import serializers
class TaskPaths(TaskSetting):
    name = "task_paths"
    validator = validate_list
    default = []
    desc = """\
        List of python dotted paths where tasks are located.

        This parameter can only be specified during initialization or in a
        :ref:`config file <setting-config>`.
        """


class SchedulePeriodic(TaskSetting):
    name = 'schedule_periodic'
    flags = ["--schedule-periodic"]
    validator = validate_bool
    action = "store_true"
    default = False
    desc = '''\
        Enable scheduling of periodic tasks.

        If enabled, :class:`.PeriodicJob` will produce
        tasks according to their schedule.
        '''


class MessageSerializer(TaskSetting):
    name = 'message_serializer'
    flags = ["--message-serializer"]
    choices = tuple(serializers)

# Path: pq/utils/serializers.py
# def serializer(cls):
#     def __new__(cls, name, bases, attrs):
#     def consumer(cls):
#     def get(self, name):
#     def tojson(self):
#     def __init__(self, *args, **kwargs):
#     def decode(cls, data):
#     def encode(cls, message):
#         def decode(cls, data):
#         def encode(cls, message):
# def queue_message(d, type=None):
#     def default(self, o):
# def as_message(o):
# class MessageMetaClass(type):
# class Message(metaclass=MessageMetaClass):
# class MessageDict(Message):
# class Json:
#     class MsgPack:
# class JSONEncoder(json.JSONEncoder):


# Path: pq/server/config.py
from pulsar.api import Setting
from pulsar.utils.config import (
    validate_list, validate_bool, validate_pos_float
)
from pulsar.utils.importer import module_attribute
from ..utils.serializers import serializers

class TaskPaths(TaskSetting):
    name = "task_paths"
    validator = validate_list
    default = []
    desc = """\
        List of python dotted paths where tasks are located.

        This parameter can only be specified during initialization or in a
        :ref:`config file <setting-config>`.
        """


class SchedulePeriodic(TaskSetting):
    name = 'schedule_periodic'
    flags = ["--schedule-periodic"]
    validator = validate_bool
    action = "store_true"
    default = False
    desc = '''\
        Enable scheduling of periodic tasks.

        If enabled, :class:`.PeriodicJob` will produce
        tasks according to their schedule.
        '''


class MessageSerializer(TaskSetting):
    name = 'message_serializer'
    flags = ["--message-serializer"]
    choices = tuple(serializers)

    default = tuple(serializers)[0]