###############################################################################
#                                                                             #
#  Kindergarden - a Content Management System for children                    #
#  Copyright (C) 2005 Guido Wesdorp                                           #
#  email johnny@debris.demon.nl                                               #
#                                                                             #
#  This program is free software; you can redistribute it and/or modify       #
#  it under the terms of the GNU General Public License as published by       #
#  the Free Software Foundation; either version 2 of the License, or          #
#  (at your option) any later version.                                        #
#                                                                             #
#  This program is distributed in the hope that it will be useful,            #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of             #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
#  GNU General Public License for more details.                               #
#                                                                             #
#  You should have received a copy of the GNU General Public License          #
#  along with this program; if not, write to the Free Software                #
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  #
#                                                                             #
###############################################################################

from zope.interface import Interface
from zope.schema import Text, TextLine, Field
from zope.i18nmessageid import MessageIDFactory
_ = MessageIDFactory('kindergarden')

from zope.app.container.interfaces import IContainer, IContained
from zope.app.container.constraints import ContainerTypesConstraint
from zope.app.container.constraints import ItemTypePrecondition

class IKindergardenResource(Interface):
    """Base class of all Kindergarden objects"""

class IKindergardenItem(IKindergardenResource):
    """Base class of everything but the root"""

class IKindergardenBaseCollection(IKindergardenResource, IContainer):
    """General collection baseclass"""

    def __setitem__(name, object):
        """Add a resource"""

    __setitem__.precondition = ItemTypePrecondition(IKindergardenItem)

class IKindergarden(IKindergardenBaseCollection):
    """Root of the website"""

class IKindergardenCollection(IKindergardenItem, IKindergardenBaseCollection):
    """Base class of all Kindergarden collections (directories)"""

class IKindergardenContained(IContained):
    """An object with content"""
    
    __parent__ = Field(
            constraint = ContainerTypesConstraint(IKindergardenCollection))

class IKindergardenDocument(IKindergardenItem):
    """A plain HTML document"""

    content = Text(title=_('HTML content'))

class IKindergardenFolder(IKindergardenCollection):
    """A plain folder"""

