## $Id: utils.py 12617 2015-02-14 17:22:51Z 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
##
"""Customize general helper utilities for Ikoba.
"""
import pytz
from waeup.ikoba.utils.utils import IkobaUtils, sorted_phone_prefixes
from ikobacustom.pcn.interfaces import MessageFactory as _

INT_PHONE_PREFIXES = [
    (1, _('Nigeria'), '234'),
    (99, _('Germany'), '49'),
    (99, _('United States'), '1'),
    (99, _('Niger'), '227'),
    (99, _('Benin'), '229'),
    (99, _('Cameroon'), '237'),
    (99, _('United Kingdom'), '44'),
    (99, _('France'), '33'),
    ]

class PCNIkobaUtils(IkobaUtils):
    """A collection of methods subject to customization.
    """
    PORTAL_LANGUAGE = 'en'

    # CURRENCIES must be equal to or an excerpt of ISO_4217_CURRENCIES
    CURRENCIES = {
        'EUR': ('EUROPE', _('Euro'), 2, '978'),
        'USD': ('U.S.', _('US Dollar'), 2, '840'),
        'NGN': ('NIGERIA', _('Naira'), 2, '566'),
        }

    CON_CATS_DICT = {
        'ron': 'Retention of Name',
        'rop': 'Registration of Premises',
        'rpr': 'Registration in the Provisional Register',
        'rpc': 'Registration as Pharmaceutical Chemist',
        'ippmvl': 'Issuance of Patent and Proprietary Medicines Vendors License',
        'rppmvl': 'Renewal of Patent and Proprietary Medicines Vendors License',
        'appit': 'Accepting Pupil Pharmacist for Internship Training',
        'rpt': 'Registration as a Pharmacy Technician',
        'appt': 'Annual Permit for Pharmacy Technician',
        'no': 'no license',
        }

    PREFERRED_LANGUAGES_DICT = {
        'en':(1, u'English'),
        'fr':(2, u'Fran&ccedil;ais'),
        'de':(3, u'Deutsch'),
        'ha':(4, u'Hausa'),
        'yo':(5, u'Yoruba'),
        'ig':(6, u'Igbo'),
        }

    EXPORTER_NAMES = (
        'pdfdocuments',
        'htmldocuments',
        'restdocuments',
        'users',
        'products',
        'customers',
        'pcncustomerjpgdocuments',
        'pcncustomerpdfdocuments',
        'roncontracts',
        'ropcontracts',
        'rprcontracts',
        'rpccontracts',
        'ippmvlcontracts',
        'rppmvlcontracts',
        'appitcontracts',
        'rptcontracts',
        'apptcontracts')

    BATCH_PROCESSOR_NAMES = (
        'pcncustomerprocessor',
        'pcncustomerjpgdocumentprocessor',
        'pcncustomerpdfdocumentprocessor',
        'roncontractprocessor',
        'ropcontractprocessor',
        'rprcontractprocessor',
        'rpccontractprocessor',
        'ippmvlcontractprocessor',
        'rppmvlcontractprocessor',
        'appitcontractprocessor',
        'rptcontractprocessor',
        'apptcontractprocessor',
        'pcnproductprocessor',
        'pdfdocumentprocessor',
        'htmldocumentprocessor',
        'restdocumentprocessor',
        'userprocessor')

    #: A function to return
    @classmethod
    def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None):
        return sorted_phone_prefixes(data, request)

    @property
    def tzinfo(self):
        return pytz.timezone('Africa/Lagos')
