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 = 'exp_e4c_fr_p1_quest'
    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):

    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()

    q_1 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_2_a = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )


    q_2_b = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_2_c = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_22 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )



    q_2_e_a = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_2_e_b = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_2_e_c = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_2_h = models.StringField(
        label="",
        blank=True
    )

    q_3 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_4 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_5 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )
    # q_6 = models.IntegerField(
    #     choices=[
    #         [1, '1'],
    #         [2, '2'],
    #         [3, '3'],
    #         [4, '4'],
    #         [5, '5'],
    #         [6, '6'],
    #     ],
    #     widget=widgets.RadioSelectHorizontal,
    #     label="",
    #     blank=False
    # )

    q_6 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
            [5, '5 - Je ne bois pas de café (thé) à l’école / au travail'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_7 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_8 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_9 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_10 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )
    # q_11 = models.IntegerField(
    #     choices=[
    #         [1, '1 - Jamais'],
    #         [2, '2 - Rarement'],
    #         [3, '3 - Souvent'],
    #         [4, '4 - Toujours'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label="",
    #     blank=False
    # )

    q_11 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
            [5, '5 - Je n’utilise pas de piles'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )
################################################  page Questionnaire 1

    q_12 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_13 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_14 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_15 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_16 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_17 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_18 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_19 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )
    q_19_a = models.IntegerField(
        label="",
        blank=True
    )

    q_19_b = models.StringField(
        label="",
        blank=True
    )

    q_20 = models.IntegerField(
        choices=[
            [1, 'a-	Green (100% électrique ou hybride) (à 26 € la course)'],
            [2, 'b-	UberX (Économique, rapide et fiable) (à 22€ la course)'],
            [3, 'c-	Comfort (Véhicules spacieux et chauffeurs les mieux notés) (à 30€ la course)'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_21 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_22_p2 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_23 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
            [5, '5 - Je ne conduis pas'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

#################################################  Page : Questionnaire2

    q_24 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_25 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_26 = models.IntegerField(
        choices=[
            [1, '1 - Jamais'],
            [2, '2 - Rarement'],
            [3, '3 - Souvent'],
            [4, '4 - Toujours'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_27 = models.IntegerField(
        choices=[
            [0, 'Oui'],
            [1, 'Non'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_27_a = models.StringField(
        label="Si oui, laquelle ? ",
        blank=True
    )

    q_28 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )
    q_29_a = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_29_b = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_29_c = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_29_d = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )


    q_30_a = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_30_b = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_30_c = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_30_d = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_30_e = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_30_f = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_31 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

    q_32 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )



    q_33 = models.IntegerField(
        choices=[
            [0, 'Oui'],
            [1, 'Non'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )


##################################### Page : Questionnaire3

    q_34_a = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )
    q_34_b = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )
    q_34_c = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
            [7, '7'],
            [8, '8'],
            [9, '9'],
            [10, '10'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )





