## $Id: interfaces.py 17924 2024-09-12 10:14:59Z henrik $
##
## Copyright (C) 2012 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 zope import schema
from waeup.kofa.students.vocabularies import StudyLevelSource
from waeup.kofa.interfaces import (
    IKofaObject, academic_sessions_vocab, validate_email)
from kofacustom.nigeria.students.interfaces import (
    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
    INigeriaStudentPersonal, INigeriaStudentStudyLevel,
    INigeriaStudentStudyCourse, INigeriaCourseTicket,
    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
    )
from kofacustom.unidel.payments.interfaces import ICustomOnlinePayment
from kofacustom.unidel.interfaces import MessageFactory as _

class ICustomStudentBase(INigeriaStudentBase):
    """Representation of student base data.

    """

    email2 = schema.ASCIILine(
        title = _(u'Institutional Email'),
        required = False,
        constraint=validate_email,
        )

ICustomStudentBase['email2'].order = ICustomStudentBase[
    'email'].order

class ICustomStudentPersonal(INigeriaStudentPersonal):
    """Student personal data.

    """

class ICustomUGStudentClearance(INigeriaUGStudentClearance):
    """Representation of ug student clearance data.

    """

class ICustomPGStudentClearance(INigeriaPGStudentClearance):
    """Representation of pg student clearance data.

    """


class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
    ICustomPGStudentClearance,ICustomStudentPersonal):
    """Representation of a student.

    """

class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
    """A container for student study levels.

    """

class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
    """A container for course tickets.

    """

    total_credits_s1 = schema.Int(
        title = _(u'1st Semester Credits'),
        required = False,
        )

    total_credits_s2 = schema.Int(
        title = _(u'2nd Semester Credits'),
        required = False,
        )

    total_credits = schema.Int(
        title = _(u'Total Credits'),
        required = False,
        )

class ICustomStudentOnlinePayment(ICustomOnlinePayment):
    """A student payment via payment gateways.

    This Interface does not inherit from IStudentOnlinePayment.
    Thus all fields from IStudentOnlinePayment have to be repeated here.
    """

    p_current = schema.Bool(
        title = _(u'Current Session Payment'),
        default = True,
        required = False,
        )

    p_level = schema.Choice(
        title = _(u'Payment Level'),
        source = StudyLevelSource(),
        required = False,
        )

ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
    'p_session'].order

class ICustomCourseTicket(INigeriaCourseTicket):
    """A course ticket.

    """

    score = schema.Int(
        title = _(u'Score'),
        required = False,
        readonly = False,
        max = 100,
        )

    ca = schema.Int(
        title = _(u'CA'),
        default = None,
        required = False,
        missing_value = None,
        max = 90,
        )

ICustomCourseTicket['score'].order = INigeriaCourseTicket['score'].order
ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order

class ICustomCourseTicketImport(ICustomCourseTicket):
    """An interface for importing course results and nothing more.
    """
    
    score = schema.Int(
        title = _(u'Score'),
        required = False,
        readonly = False,
        max = 100,
        )

    ca = schema.Int(
        title = _(u'CA'),
        required = False,
        readonly = False,
        max = 90,
        )

    level_session = schema.Choice(
        title = _(u'Level Session'),
        source = academic_sessions_vocab,
        required = False,
        readonly = False,
        )


class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
    """Representation of a student. Skip regular reg_number validation.

    """

class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
    """Representation of a student. Skip regular matric_number validation.

    """
