# -*- coding: utf-8 -*-
"""
Registrul chestionarelor. Fiecare chestionar are definitia lui de intrebari
(modul generat de extract_form.py) si tabelul lui propriu in baza de date.
"""
import questions_b12
import questions_carburanti

FORMS = {
    "b12": {
        "id": "b12",
        "name": "Chestionar Beneficiar 12 - Obiective fără cerințe minime",
        "questions": questions_b12,
        "table": "submissions_b12",
        "slug": "b12",
        "path": "/",
    },
    "carburanti": {
        "id": "carburanti",
        "name": "Chestionar Beneficiar 6 - Obiective Comercializare carburanți",
        "questions": questions_carburanti,
        "table": "submissions_carburanti",
        "slug": "carburanti",
        "path": "/carburanti",
    },
}

ORDER = ["b12", "carburanti"]      # ordinea pentru sageti
DEFAULT = "b12"                    # chestionarul implicit


def get(form_id):
    return FORMS.get(form_id)


def other(form_id):
    """Celalalt chestionar (pentru sagetile de comutare)."""
    i = ORDER.index(form_id)
    return FORMS[ORDER[(i + 1) % len(ORDER)]]


def all_forms():
    return [FORMS[f] for f in ORDER]
