## $Id: interfaces.py 16589 2021-08-31 14:41:29Z henrik $
##
## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
## 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  grok import getSite
from datetime import datetime
from zope.component import getUtility
from zope.catalog.interfaces import ICatalog
from zope.interface import invariant, Invalid, Attribute, Interface
from zope import schema
from waeup.kofa.interfaces import SimpleKofaVocabulary
from waeup.kofa.hostels.interfaces import IHostel, IBed

from kofacustom.ecns.interfaces import MessageFactory as _

blocks = SimpleKofaVocabulary(
    (_('Block 1'),'1'),
    (_('Block 2'),'2'),
    (_('Block 3'),'3'),
    (_('Block 4'),'4'),
    (_('Block 5'),'5'),
    (_('Block 6'),'6'),
    (_('Block 7'),'7'),
    (_('Block 8'),'8'),
    (_('Block 9'),'9'),
    (_('Block 10'),'10'),
    (_('Block 11'),'11'),
    (_('Block 12'),'12'),
    (_('Block 13'),'13'),
    (_('Block 14'),'14'),
    (_('Block 15'),'15'),
    (_('Block 16'),'16'),
    (_('Block 17'),'17'),
    (_('Block 18'),'18'),
    (_('Block 19'),'19'),
    )

class ICustomHostel(IHostel):
    """Representation of a hostel.
    """

    floors_per_block = schema.Int(
        title = _(u'Flats per Block'),
        required = True,
        default = 1,
        )

    rooms_per_floor = schema.Int(
        title = _(u'Rooms per Flat'),
        required = True,
        default = 2,
        )

    blocks_for_female = schema.List(
        title = _(u'Blocks for Female Students'),
        value_type = schema.Choice(
            vocabulary = blocks
            ),
        defaultFactory=list,
        )

    blocks_for_male = schema.List(
        title = _(u'Blocks for Male Students'),
        value_type = schema.Choice(
            vocabulary = blocks
            ),
        defaultFactory=list,
        )

ICustomHostel['floors_per_block'].order = IHostel[
    'floors_per_block'].order
ICustomHostel['rooms_per_floor'].order = IHostel[
    'rooms_per_floor'].order
ICustomHostel['blocks_for_female'].order = IHostel[
    'blocks_for_female'].order
ICustomHostel['blocks_for_male'].order = IHostel[
    'blocks_for_male'].order

class ICustomBed(IBed):
    """Representation of a bed.
    """

