##
## interfaces.py
from zope.interface import Interface, Attribute
from zope import schema
from waeup.sirp.interfaces import IWAeUPObject
from waeup.sirp.university.vocabularies import study_modes
from waeup.sirp.students.vocabularies import (
  year_range, lgas_vocab, CertificateSource, GenderSource,
  academic_sessions_vocab, verdicts, StudyLevelSource,
  )

class IStudentsContainer(IWAeUPObject):
    """An students container contains university students.

    """

    def addStudent(student):
        """Add an IStudent object and subcontainers.

        """

    def archive(id=None):
        """Create on-dist archive of students.

        If id is `None`, all students are archived.

        If id contains a single id string, only the respective
        students are archived.

        If id contains a list of id strings all of the respective
        students types are saved to disk.
        """

    def clear(id=None, archive=True):
        """Remove students of type given by 'id'.

        Optionally archive the students.

        If id is `None`, all students are archived.

        If id contains a single id string, only the respective
        students are archived.

        If id contains a list of id strings all of the respective
        student types are saved to disk.

        If `archive` is ``False`` none of the archive-handling is done
        and respective students are simply removed from the
        database.
        """

class IStudentNavigation(IWAeUPObject):
    """Interface needed for student navigation.
    """

    def getStudent():
        """Return student object.
        """

class IStudentBase(IWAeUPObject):
    """Representation of student base data.
    """
    history = Attribute('Object history, a list of messages.')
    state = Attribute('Returns the registration state of a student')
    #student_id = Attribute('Randomly generated id')
    password = Attribute('Encrypted password of a student')
    adm_code = Attribute('Admission checking access code')

    def loggerInfo(ob_class, comment):
        """Adds an INFO message to the log file
        """

    student_id = schema.TextLine(
        title = u'Student ID',
        required = True,
        )

    name = schema.TextLine(
        title = u'Full Name',
        default = u'Nobody',
        required = True,
        )

    reg_number = schema.TextLine(
        title = u'Registration Number',
        default = u'',
        required = True,
        readonly = False,
        )

class IStudentClearance(IWAeUPObject):
    """Representation of student clearance data.
    """

    date_of_birth = schema.Date(
        title = u'Date of Birth',
        required = True,
        )

    clearance_locked = schema.Bool(
        title = u'Clearance form locked',
        default = False,
        )

class IStudentPersonal(IWAeUPObject):
    """Representation of student personal data.
    """

    perm_address = schema.Text(
        title = u'Permanent Address',
        required = False,
        )

class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
    """Representation of a student.
    """

class IStudentStudyCourse(IWAeUPObject):
    """A container for student study levels.

    """

    certificate = schema.Choice(
        title = u'Certificate',
        source = CertificateSource(),
        default = None,
        required = True,
        )

    current_session = schema.Choice(
        title = u'Current Session',
        source = academic_sessions_vocab,
        default = None,
        required = True,
        )

    current_level = schema.Choice(
        title = u'Current Level',
        source = StudyLevelSource(),
        default = None,
        required = False,
        )

    current_verdict = schema.Choice(
        title = u'Current Verdict',
        source = verdicts,
        default = None,
        required = False,
        )

    previous_verdict = schema.Choice(
        title = u'Previous Verdict',
        source = verdicts,
        default = None,
        required = False,
        )

class IStudentAccommodation(IWAeUPObject):
    """A container for student accommodation objects.

    """

class IStudentPayments(IWAeUPObject):
    """A container for student payment objects.

    """

# Interfaces for students only

class IStudentBaseEdit(IStudentBase):
    """Interface needed for editing of student base data by students.
    """

    name = schema.TextLine(
        title = u'Full Name',
        default = u'Nobody',
        required = True,
        readonly = True,
        )

IStudentBaseEdit['name'].order =  IStudentBase['name'].order

class IStudentClearanceEdit(IStudentClearance):
    """Interface needed for restricted editing of student clearance data.
    """

class IStudentPersonalEdit(IStudentPersonal):
    """Interface needed for restricted editing of student personal data.
    """
