from otree.api import (
    models,
    widgets,
    BaseConstants,
    BaseSubsession,
    BaseGroup,
    BasePlayer,
    Currency as c,
    currency_range,
)

doc = """
author = 'Wael Bousselmi'
Exp E4C
"""


class Constants(BaseConstants):
    name_in_url = 'v2_exp_e4c_a_p0'
    players_per_group = None
    num_rounds = 1

    showupfee = 0

    tauxchange = 0.8 # 1 ecu = 0.8 €


class Subsession(BaseSubsession):

    def vars_for_admin_report(self):
        report = list()
        for p in self.get_players():
            report.append(dict(id=p.participant.id_in_session,
                               label=p.participant.label,
                               ))
        return dict(report=report)

class Group(BaseGroup):
    pass



class Player(BasePlayer):

    id_in_group_nn = models.IntegerField()
    secondexp = models.StringField()
    ########################################  le code ci-dessous ne fonctionne pas (du role)
    # def role(self):
    #     return {1: 'A', 2: 'B'}[self.id_in_group]

    treatment = models.IntegerField()
################################################  page Questionnaire 0

    versionexp = models.IntegerField(
        choices=[
            [1, '1 - Je veux participer en "Français" '],
            [2, '2 - I want to participate in "English" '],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    language = models.StringField()







