# -*- coding: utf-8 -*-
############################################################################################
#
#    Zoook. OpenERP e-sale, e-commerce Open Source Management Solution
#    Copyright (C) 2011 Zikzakmedia S.L. (<http://www.zikzakmedia.com>). All Rights Reserved
#
#    Module Created: 2013-03-22
#    Author: Mariano Ruiz <mrsarm@gmail.com>,
#            Enterprise Objects Consulting (<http://www.eoconsulting.com.ar>)
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
############################################################################################


def format_vat(vat):
    if not vat:
        return u''
    if vat[0:2] == 'AR':
        return format_vat_ar(vat)

    # PUT HERE other country format

    return vat


def format_vat_ar(vat):
    '''
    Returns VAT formated conform to Argentine mask (C.U.I.T.).
    Eg.: "AR20101234569" -> "20-10123456-9" 
    '''
    return u"%s-%s-%s" % (vat[2:4], vat[4:12], vat[12:])
