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


# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca 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.
#
# OpenFisca 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/>.


import collections
import functools

from openfisca_core.columns import build_column_couple
from openfisca_core.enumerations import Enum

from .. import entities


QUIFOY = Enum(['vous', 'conj', 'pac1', 'pac2', 'pac3', 'pac4', 'pac5', 'pac6', 'pac7', 'pac8', 'pac9'])
QUIMEN = Enum(['pref', 'cref', 'enf1', 'enf2', 'enf3', 'enf4', 'enf5', 'enf6', 'enf7', 'enf8', 'enf9'])

column_by_name = collections.OrderedDict()
prestation_by_name = collections.OrderedDict()


build_column_couple = functools.partial(
    build_column_couple,
    entity_class_by_symbol = entities.entity_class_by_symbol,
    )

@@ -982,17 +982,43 @@
 n_couple
+, reference_input_variable
 %0A
-
 from ope
@@ -1053,16 +1053,70 @@
 ort Enum
+%0Afrom openfisca_core.formulas import reference_formula
 %0A%0Afrom .
@@ -1436,16 +1436,45 @@
 ict()%0A%0A%0A
+# Functions and decorators%0A%0A%0A
 build_co
@@ -1531,16 +1531,16 @@
 couple,%0A
-
     enti
@@ -1599,8 +1599,210 @@
 ,%0A    )%0A
+%0A%0Areference_formula = reference_formula(prestation_by_name = prestation_by_name)%0A%0A%0Areference_input_variable = functools.partial(%0A    reference_input_variable,%0A    column_by_name = column_by_name,%0A    )%0A

Add functions and decorators to declare a reference input variable and a reference formula, using a better syntax than build_column... functions.