##
## interfaces.py
## Login : <uli@pu.smp.net>
## Started on  Sun Jun 27 11:06:23 2010 Uli Fouquet
## $Id$
## 
## Copyright (C) 2010 Uli Fouquet
## 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
##
"""Interfaces for JAMB data tables and related components.
"""
from zope import schema
from waeup.sirp.interfaces import IWAeUPObject
from waeup.sirp.applicants.interfaces import (
    IApplicantBaseData, IApplicantsFormChallenger,
    IApplicantSessionCredentials,
    )


class IJAMBDataRoot(IWAeUPObject):
    """A container that holds JAMB data tables.
    """

class IApplicantPDEImportData(IApplicantBaseData):
    """Data for applicants, that passed PDE screening.

    This data set should be suitable for imports from JAMB tables. It
    is also basicall the basic applicant data from
    :class:`IApplicantBaseData` only with the required fields set.

    """
    firstname = schema.TextLine(
        title = u'First Name',
        required = True,
        )
    middlenames = schema.TextLine(
        title = u'Middle Names',
        required = True,
        )
    lastname = schema.TextLine(
        title = u'Surname/Full Name',
        required = True,
        )
    date_of_birth = schema.Date(
        title = u'Date of Birth',
        required = True,
        )
    jamb_state = schema.TextLine(
        title = u'State (provided by JAMB)',
        required = True,
        )
    jamb_lga = schema.TextLine(
        title = u'LGA (provided by JAMB)',
        required = True,
        )
    course1 = schema.TextLine(
        title = u'1st Choice Course of Study',
        required = True,
        )
    screening_date = schema.Date(
        title = u'Screening Date',
        required = True,
        )
    screening_type = schema.TextLine(
        # XXX: schould be choice
        title = u'Screening Type',
        required = True,
        )
    screening_venue = schema.TextLine(
        title = u'Screening Venue',
        required = True,
        )
    entry_session = schema.TextLine(
        # XXX: should be choice
        # XXX: should have sensible default: upcoming session
        title = u'Entry Session',
        required = True,
        )

class IJAMBApplicantsFormChallenger(IApplicantsFormChallenger):
    """A challenger that uses a browser form to collect applicant
       credentials for applicants in JAMB process.

       JAMB-screened applicants have to provide an extra registration
       no. provided by JAMB.
    """
    jamb_reg_no_field = schema.TextLine(
        title = u'JAMB registration no.',
        description = u'''Field of the login page which is looked up for
                          the JAMB registration number.''',
        default = u'jamb_reg_no',
        )

class IJAMBApplicantSessionCredentials(IApplicantSessionCredentials):
    """Interface for storing and accessing JAMB applicant credentials in a
       session.
    """

    def __init__(access_code, jamb_reg_no):
        """Create credentials for JAMB screened applicants."""

    def getJAMBRegNo():
        """Return the JAMB registration no."""
