##
## interfaces.py
from zope.interface import Attribute, invariant
from zope import schema
from waeup.sirp.interfaces import IWAeUPObject
from waeup.sirp.payments.vocabularies import (
    payment_states, payment_categories)

class IPaymentsContainer(IWAeUPObject):
    """A container for all kind of payment objects.

    """

class IPayment(IWAeUPObject):
    """A base representation of payments.

    """
    p_id = Attribute('Payment identifier.')

    p_state = schema.Choice(
        title = u'Payment State',
        default = u'unpaid',
        vocabulary = payment_states,
        required = True,
        )

    p_category = schema.Choice(
        title = u'Payment Category',
        default = u'schoolfee',
        vocabulary = payment_categories,
        required = True,
        )

    p_item = schema.TextLine(
        title = u'Payment Item',
        default = None,
        required = False,
        )

    creation_date = schema.Datetime(
        title = u'Ticket Creation Date',
        readonly = True,
        )

    payment_date = schema.Date(
        title = u'Payment Date',
        required = False,
        readonly = True,
        )

    amount_auth = schema.Int(
        title = u'Amount Authorized',
        default = 0,
        required = True,
        readonly = True,
        )

class ISCPayment(IPayment):
    """A scratch card payment.

    """

    p_code = schema.TextLine(
        title = u'Payment Access Code',
        default = u'Certificate XYZ',
        required = False,
        readonly = True,
        )

class IOnlinePayment(IPayment):
    """A payment via payment gateways.

    """

    surcharge_1 = schema.Int(
        title = u'Surcharge 1',
        default = 0,
        required = False,
        readonly = True,
        )

    surcharge_2 = schema.Int(
        title = u'Surcharge 2',
        default = 0,
        required = False,
        readonly = True,
        )

    surcharge_3 = schema.Int(
        title = u'Surcharge 3',
        default = 0,
        required = False,
        readonly = True,
        )

    #order_id = schema.TextLine(
    #    title = u'Order Id',
    #    default = None,
    #    required = True,
    #    )

    r_amount_approved = schema.Int(
        title = u'Response Amount Approved',
        default = 0,
        required = False,
        readonly = True,
        )

    r_code = schema.TextLine(
        title = u'Response Code',
        default = None,
        required = False,
        readonly = True,
        )

    r_card_num = schema.TextLine(
        title = u'Response Card Number',
        default = None,
        required = False,
        readonly = True,
        )