"""Interfaces of access code related components. """ from zope import schema from zope.interface import Interface from waeup.sirp.interfaces import IWAeUPObject class IAccessCode(IWAeUPObject): """An access code. """ batch_serial = schema.Int( title = u'Serial number inside batch', ) batch_prefix = schema.TextLine( title = u'Prefix inside batch', ) batch_num = schema.Int( title = u'Batch number', ) random_num = schema.TextLine( title = u'Random part of access code.', ) cost = schema.Float( title = u'Cost of access code', default = 0.0, min = 0.0, ) state = schema.TextLine( title = u'Workflow state', ) representation = schema.TextLine( title = u'Complete title of access code', ) owner = schema.TextLine( title = u'Purchaser', ) history = schema.Text( title = u'The history of access code as lines', default = u'', readonly = True, ) class IAccessCodeBatch(Interface): """A factory for batches of access codes. """ creation_date = schema.Date( title = u'Creation date', ) creator = schema.TextLine( title = u'Batch creator', ) prefix = schema.TextLine( title = u'Batch prefix', ) num = schema.Int( title = u'Batch number (1-3 digits)', min = 0, max = 999, ) entry_num = schema.Int( title = u'Number of access codes', default = 1000, min = 0, ) cost = schema.Float( title = u'Cost of access code', default = 0.0, min = 0.0, ) disabled_num = schema.Int( title = u'Number of disabled access codes inside the batch', default = 0, readonly = True, ) used_num = schema.Int( title = u'Number of used access codes inside the batch', default = 0, readonly = True, ) class IAccessCodeBatchContainer(IWAeUPObject): """A container for access code batches. """ def addBatch(batch): """Add a batch. """