from .vocabularies import todo_priority
from plone.autoform.interfaces import IFormFieldProvider
from plone.supermodel import model
from ploneintranet.core import _
from zope.interface import Interface
from zope.interface import provider
from zope.schema import Choice
from zope.schema import Date
from zope.schema import Text
from zope.schema import TextLine


@provider(IFormFieldProvider)
class ITodo(model.Schema):
    """Todo schema"""

    description = Text(title="Long description", required=False)

    initiator = TextLine(
        title=_("Initiator"),
        description=_("The user (or group) who requested this task"),
        required=False,
    )

    assignee = TextLine(
        title=_("Assignee"),
        description=_("A user (or a group) assigned to this task"),
        required=False,
    )

    priority = Choice(
        title=_("Priority"), required=True, default=-1, vocabulary=todo_priority
    )

    due = Date(title=_("Due date"), required=False)


class ITodoMarker(Interface):
    """Marker interface that will be provided by instances using the
    ITodo behavior.
    """


@provider(IFormFieldProvider)
class IMilestone(model.Schema):
    """A text field representing the milestone associated with this todo item.
    For example, the id of the associated workflow state of the container.
    """

    milestone = TextLine(title=_("Milestone"), required=False)


class IMilestoneMarker(Interface):
    """Marker interface that will be provided by instances using the
    IMilestone behavior.
    """
