## $Id: interfaces.py 16509 2021-06-16 12:52:36Z 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.interfaces import (
    validate_email, IKofaObject,
    academic_sessions_vocab)
from waeup.kofa.students.vocabularies import StudyLevelSource
from kofacustom.nigeria.interfaces import GradingSystemSource
from kofacustom.nigeria.students.interfaces import (
    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
    INigeriaStudentPersonal, INigeriaStudentPersonalEdit,
    INigeriaStudentStudyLevel,
    INigeriaStudentStudyCourse, INigeriaCourseTicket,
    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
    )
from waeup.uniben.payments.interfaces import ICustomOnlinePayment
from waeup.uniben.interfaces import MessageFactory as _


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

    library = schema.Bool(
        title = _(u'Library Id Card'),
        default = False,
        required = False,
        )

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

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

class IMedicalHistory(IKofaObject):
    """Students Medical History Questionnaire.
    """

    medical_updated = schema.Datetime(
        title = _(u'Last updated'),
        required = False,
        readonly = False,
        )

    # History of Symptoms

    fever = schema.Bool(
        title = _(u'Fever'),
        default = False,
        required = True,
        )

    headaches = schema.Bool(
        title = _(u'Headaches'),
        default = False,
        required = True,
        )

    catarrh = schema.Bool(
        title = _(u'Catarrh'),
        default = False,
        required = True,
        )

    cough = schema.Bool(
        title = _(u'Cough'),
        default = False,
        required = True,
        )

    sore_throat = schema.Bool(
        title = _(u'Sore throat'),
        default = False,
        required = True,
        )

    breathing = schema.Bool(
        title = _(u'Difficulty with breathing'),
        default = False,
        required = True,
        )

    sneezing = schema.Bool(
        title = _(u'Sneezing'),
        default = False,
        required = True,
        )

    weakness = schema.Bool(
        title = _(u'Weakness/tiredness'),
        default = False,
        required = True,
        )

    body_pains = schema.Bool(
        title = _(u'Body pains'),
        default = False,
        required = True,
        )

    smell = schema.Bool(
        title = _(u'Loss of smell (inability to smell)'),
        default = False,
        required = True,
        )

    taste = schema.Bool(
        title = _(u'Loss of taste'),
        default = False,
        required = True,
        )

    # Medical History

    asthma = schema.Bool(
        title = _(u'Asthma'),
        default = False,
        required = True,
        )

    hypertension = schema.Bool(
        title = _(u'Hypertension'),
        default = False,
        required = True,
        )

    diabetes = schema.Bool(
        title = _(u'Diabetes'),
        default = False,
        required = True,
        )

    obesity = schema.Bool(
        title = _(u'Obesity'),
        default = False,
        required = True,
        )

    others = schema.TextLine(
        title = _(u'Others'),
        required = False,
        )

    medicines = schema.TextLine(
        title = _(u'Are you on a regular medication? If yes, list the medicines'),
        required = False,
        )

    # Travel History

    lagos_abuja = schema.Bool(
        title = _(u'Have you travelled to Lagos or Abuja in the last two weeks?'),
        default = False,
        required = True,
        )

    outside = schema.Bool(
        title = _(u'Have you travelled outside the country in the last 4 weeks?'),
        default = False,
        required = True,
        )

    # History of contact/infection

    company_suspected = schema.Bool(
        title = _(u'Were you in the company of a suspected case of COVID 19 in the last two weeks?'),
        default = False,
        required = True,
        )

    company_confirmed = schema.Bool(
        title = _(u'Were you in the company of a confirmed case of COVID 19 in the last two weeks?'),
        default = False,
        required = True,
        )

    positive = schema.Bool(
        title = _(u'Have you had a positive COVID 19 test done?'),
        default = False,
        required = True,
        )

    negative = schema.Bool(
        title = _(u'Have you had a negative COVID 19 test done?'),
        default = False,
        required = True,
        )

    vaccination = schema.Bool(
        title = _(u'Have you had COVID 19 vaccination?'),
        default = False,
        required = True,
        )

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

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

class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit):
    """Interface for editing personal data by students.
    """

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

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

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

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

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

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

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,
        )

    staff_rebate = schema.Bool(
        title = _(u'Staff Rebate Payment'),
        default = False,
        required = False,
        )

    rebate_amount = schema.Float(
        title = _(u'Rebate'),
        default = 0.0,
        required = False,
        readonly = False,
        )

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

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

    grading_sys = schema.Choice(
        title = _(u'Grading System'),
        source = GradingSystemSource(),
        required = True,
        default = 'A',
        )

class ICustomCourseTicketImport(ICustomCourseTicket):
    """An interface for importing course results and nothing more.
    """

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

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

    grading_sys = schema.Choice(
        title = _(u'Grading System'),
        source = GradingSystemSource(),
        required = False,
        default = 'A',
        )

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

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