from Products.ATContentTypes.content import schemata
from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import \
    ReferenceBrowserWidget
from Products.Archetypes import atapi
from Products.SimpleReference import SimpleReferenceMessageFactory as _
from Products.SimpleReference.config import PROJECTNAME
from Products.SimpleReference.interfaces import IImageReference
from zope.interface import implements
from Products.ATContentTypes.content.image import ATImage, ATImageSchema
from Products.ATContentTypes.content.base import ATCTFileContent


ImageReferenceSchema = ATImageSchema.copy() + atapi.Schema((

    atapi.ReferenceField("image",
        title=_(u"Image Reference"),
        relationship='image_reference',
        allowed_types=('Image',),
        required=True,
        primary=True,
        languageIndependent=True,
        keepReferencesOnCopy=True,
        widget=ReferenceBrowserWidget,
    ),

))

ImageReferenceSchema['title'].storage = atapi.AnnotationStorage()
ImageReferenceSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(ImageReferenceSchema, moveDiscussion=False)
'''
from Products.ATContentTypes.content import schemata
from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import \
    ReferenceBrowserWidget
from Products.Archetypes import atapi
from Products.SimpleReference import SimpleReferenceMessageFactory as _
from Products.SimpleReference.config import PROJECTNAME
from Products.SimpleReference.interfaces import IFileReference
from zope.interface import implements
from Products.ATContentTypes.content.file import ATFile, ATFileSchema


FileReferenceSchema = ATFileSchema.copy() + atapi.Schema((

    atapi.ReferenceField("file",
        title=_(u"File Reference"),
        relationship='file_reference',
        allowed_types=('File',),
        required=True,
        primary=True,
        languageIndependent=True,
        keepReferencesOnCopy=True,
        widget=ReferenceBrowserWidget,
    ),

))

FileReferenceSchema['title'].storage = atapi.AnnotationStorage()
FileReferenceSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(FileReferenceSchema, moveDiscussion=False)