# -*- coding: utf-8 -*-

from django.db import models
from django.utils.translation import ugettext_lazy as _
from models_ext import BaseModelMixin


class SaleclerkIntegralIncomeExpensesInfo(BaseModelMixin):
    INCOME = 0
    EXPENSE = 1
    UNFREEZE = 2

    TYPE = (
        (INCOME, u'收入'),
        (EXPENSE, u'支出'),
        (UNFREEZE, u'解冻'),
    )

    franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)
    clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)

    type = models.IntegerField(_(u'type'), choices=TYPE, default=INCOME, help_text=u'收支类别', db_index=True)

    code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码', db_index=True)
    integral = models.IntegerField(_(u'integral'), default=0, help_text=u'增减积分')
    left_integral = models.IntegerField(_(u'left_integral'), default=0, help_text=u'积分增减后数量(分)')

    remark = models.CharField(_(u'remark'), max_length=255, blank=True, null=True, help_text=u'备注')

    class Meta:
        verbose_name = _(u'saleclerkintegralincomeexpensesinfo')
        verbose_name_plural = _(u'saleclerkintegralincomeexpensesinfo')

    def __unicode__(self):
        return unicode(self.pk)
