from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants

import random
import time

class Bienvenue(Page):
    form_model = 'player'
    form_fields = []

    def is_displayed(self):
        return self.player.participant.vars['questionnaire_before'] == 0


    def before_next_page(self):
        self.player.game_num = self.player.participant.vars['game_num']
        self.player.app_sequence_select = self.player.participant.vars['app_sequence_select']
        self.player.questionnaire_before = self.player.participant.vars['questionnaire_before']


class Questionnaire0(Page):
    form_model = 'player'
    form_fields = ['q_1', 'q_2_a', 'q_2_b', 'q_2_c',
                   'q_22', 'q_2_e_a', 'q_2_e_b', 'q_2_e_c', 'q_2_h',
                    'q_3', 'q_4', 'q_5', 'q_6',
                   'q_7', 'q_8', 'q_9', 'q_10', 'q_11',
                       ]
    def is_displayed(self):
        return self.player.participant.vars['questionnaire_before'] == 0


class Questionnaire1(Page):
    form_model = 'player'
    form_fields = [
        'q_12', 'q_13', 'q_14', 'q_15',
         'q_16',
        'q_16_a','q_16_b', 'q_17',
        'q_18',
        'q_19_p2', 'q_20',
                   ]
    def is_displayed(self):
        return self.player.participant.vars['questionnaire_before'] == 0



class Questionnaire2(Page):
    form_model = 'player'
    form_fields = [ 'q_21', 'q_22_n', 'q_23', 'q_24',
                    'q_24_a', 'q_25',
                    'q_26_a', 'q_26_b',
                    'q_26_c', 'q_26_d',
                    'q_27_a', 'q_27_b', 'q_27_c',
                    'q_27_d',
                    'q_28_a', 'q_28_b', 'q_28_c',
                    'q_28_d', 'q_28_e', 'q_28_f',
                    'q_29_a', 'q_29_b','q_29_c', 'q_29_d',
                    'q_30', 'q_31'
                       ]
    def is_displayed(self):
        return self.player.participant.vars['questionnaire_before'] == 0




page_sequence = [
    Bienvenue,
    Questionnaire0,
    Questionnaire1,
    Questionnaire2,


]
