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 = 'a4_questappli'
    players_per_group = None
    num_rounds = 1


class Subsession(BaseSubsession):
    pass

class Group(BaseGroup):
    pass

class Player(BasePlayer):
    q1_app_installation = models.IntegerField(
        choices=[
            [0, "I didn't know such an app existed"],
            [1, "I didn't install it because I wasn't interested"],
            [2, "I didn't install it because I couldn't"],
            [3, "I installed it but never used it"],
            [4, "I installed it and used it a few times"],
            [5, "I installed it and used it regularly"],
        ],
        widget=widgets.RadioSelect,
        label="1) A mobile application for residents of Building 103 was developed last spring. Did you install it?",
        blank=False
    )

    q2_satisfaction = models.IntegerField(
        choices=[
            [1, "Very satisfied"],
            [2, "Satisfied"],
            [3, "Dissatisfied"],
            [4, "Very dissatisfied"],
            [5, "Not applicable"],
        ],
        widget=widgets.RadioSelect,
        label="2) If yes, how satisfied are you with it?",
        blank=False
    )

    q3_comments = models.LongStringField(
        label="3) Any comments about this application?",
        blank=True
    )

    q4_access_data = models.IntegerField(
        choices=[
            [0, "I did not download the application"],
            [1, "I downloaded the application, but I did not have access to this data"],
            [2, "I downloaded the application, and I had access to this data"],
        ],
        widget=widgets.RadioSelect,
        label="4) Did the application give you access to your apartment’s water and energy consumption?",
        blank=False
    )

    q5_weekly_reports = models.IntegerField(
        choices=[
            [0, "No"],
            [1, "Yes, by mail"],
            [2, "Yes, by email"],
            [3, "Yes, by both mail and email"],
        ],
        widget=widgets.RadioSelect,
        label="5) Did you receive weekly reports, either by mail or email, in addition to the application, regarding your apartment’s water and energy consumption?",
        blank=False
    )

    q6_energy_comparison = models.IntegerField(
        choices=[[i, str(i)] for i in range(1, 7)],
        label="",
        widget=widgets.RadioSelectHorizontal,
        blank = False
    )

    q7_water_comparison = models.IntegerField(
        choices=[[i, str(i)] for i in range(1, 7)],
        label="",
        widget=widgets.RadioSelectHorizontal,
        blank = False
    )





















