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 = 'a1_en_p1_quest_v2'
    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

    game_num = models.IntegerField()
    app_sequence_select = models.IntegerField()
    questionnaire_before = models.IntegerField()

    language = models.StringField()

    q_1 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        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 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_4 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        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 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
            [5, '5 - I don’t drink coffee (or the) at school/work'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_7 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_8 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_9 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_10 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        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 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
            [5, '5 - I don’t use batteries'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )
################################################  page Questionnaire 1

    q_12 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_13 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_14 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    q_15 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

    # q_16 = models.IntegerField(
    #     choices=[
    #         [1, '1 - Never'],
    #         [2, '2 - Rarely'],
    #         [3, '3 - Often'],
    #         [4, '4 - Always'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label="",
    #     blank=False
    # )
    #
    # q_17 = models.IntegerField(
    #     choices=[
    #         [1, '1 - Never'],
    #         [2, '2 - Rarely'],
    #         [3, '3 - Often'],
    #         [4, '4 - Always'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label="",
    #     blank=False
    # )
    #
    # q_18 = models.IntegerField(
    #     choices=[
    #         [1, '1 - Never'],
    #         [2, '2 - Rarely'],
    #         [3, '3 - Often'],
    #         [4, '4 - Always'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label="",
    #     blank=False
    # )

    q_16 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )
    q_16_a = models.IntegerField(
        label="",
        blank=True
    )

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

    q_17 = models.IntegerField(
        choices=[
            [1, 'a-	Green (100% electric or hybrid) (€26 per ride)'],
            [2, 'b-	UberX (Economical, fast and reliable) (at €22 per ride) '],
            [3, 'c-	Comfort (spacious vehicles and top rated drivers) (at €30 per ride)'],

        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

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

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

    q_20 = models.IntegerField(
        choices=[
            [1, '1 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
            [5, '5 - I don’t drive'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

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

    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_n = 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 - Never'],
            [2, '2 - Rarely'],
            [3, '3 - Often'],
            [4, '4 - Always'],
        ],
        widget=widgets.RadioSelect,
        label="",
        blank=False
    )

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

    q_24_a = models.StringField(
        label="If yes which one? ",
        blank=True
    )

    q_25 = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )
    q_26_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_26_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_26_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_26_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
    )



#   ------------- à modifier ici !!!!!!
    
    q_27_a = models.IntegerField(
        choices=[
            [1, '1'],
            [2, '2'],
            [3, '3'],
            [4, '4'],
            [5, '5'],
            [6, '6'],
        ],
        widget=widgets.RadioSelectHorizontal,
        label="",
        blank=False
    )

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

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

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


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

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

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

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

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

    q_28_f = 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(
        label="",
        blank=False
    )

    q_29_b = models.IntegerField(
        label="",
        blank=False
    )

    q_29_c = models.IntegerField(
        label="",
        blank=False
    )

    q_29_d = models.IntegerField(
        label="",
        blank=False
    )


    #
    # q_30 = models.IntegerField(
    #     choices=[
    #         [0, 'Yes'],
    #         [1, 'No'],
    #     ],
    #     widget=widgets.RadioSelect,
    #     label="",
    #     blank=False
    # )
    #
    # q_31 = models.StringField(
    #     label="31) What does this mean for you?",
    # )






