from os import environ


# if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs
# in SESSION_CONFIGS, except those that explicitly override it.
# the session config can be accessed from methods in your apps as self.session.config,
# e.g. self.session.config['participation_fee']

#### WB MTURK / session config MTurk           #########################

mturk_hit_settings = {
    'keywords': ['Survey', 'Game', 'Demographics'], # Questionnaire démographique #'Questionnaire', 'Français'
    'title': 'Survey (gain $3.0, duration 7 min)',# Questionnaire démographique
    'description': 'You can earn up to $3.0 in approximately 7 minutes.', # Questionnaire démographique:  Gain de $0.60 pour une durée de 1 minute.
    'frame_height': 500,
    'template': 'global/mturk_template.html',
    'minutes_allotted_per_assignment': 60,
    'expiration_hours': 7*24, # 7 days
#    'grant_qualification_id': '3O3C52ZQEUFOKIZH0662Y397HAFSHV',#  Mturk reel Exp G-J            ###to prevent retakes
#    'grant_qualification_id': '3ZSPHI510NGVHARBJTEPE3ECGE6IJ2',  # Sandbox Exp G-J
     'grant_qualification_id': '3IMKSS0I9C91UAW9OSPZY1N2EAQW6A' , # Mturk exp Covid
#     'grant_qualification_id': '3LKGAM13UYJQHAONM1Z1QYBBX0W7ES', # Sandbox exp Covid

#    'grant_qualification_id': '3C2W12C2LIJHOP5OLGDWR8T1PGZURB',#  Mturk reel Exp Ines
#    'grant_qualification_id': '3MTUBPNNZX0I8DMRLCRIX5T88L6XMM',  # Sandbox Exp Ines

    'qualification_requirements': [
        {
            'QualificationTypeId': "00000000000000000071",  # que pour expé Ines ##### workers from the US, 00000000000000000071 is the code for a location-based qualification
            'Comparator': "EqualTo",
#            'LocaleValues': [{'Country': "FR"}]
            'LocaleValues': [{'Country': "US"}]
        },

        {
#           'QualificationTypeId': "3O3C52ZQEUFOKIZH0662Y397HAFSHV", #  Mturk reel Exp G-J            ###To prevent a worker from participating in your study twice
#           'QualificationTypeId': "3ZSPHI510NGVHARBJTEPE3ECGE6IJ2", # Sandbox Exp G-J
#            'QualificationTypeId': '3C2W12C2LIJHOP5OLGDWR8T1PGZURB',#  Mturk reel Exp Ines
#           'QualificationTypeId': '3MTUBPNNZX0I8DMRLCRIX5T88L6XMM',  # Sandbox Exp Ines
            'QualificationTypeId': '3IMKSS0I9C91UAW9OSPZY1N2EAQW6A', # Mturk exp Covid
#            'QualificationTypeId':'3LKGAM13UYJQHAONM1Z1QYBBX0W7ES', # Sandbox exp Covid

            'Comparator': "DoesNotExist",
        }

]
          }
#############################################################################
SESSION_CONFIG_DEFAULTS = {
    'real_world_currency_per_point': 0.001,# 0.001 pour exp realeffort et exp covid sinon = 1
    'participation_fee': 0,# 0.5 # 0 Expé police
    'doc': "",
    'mturk_hit_settings': mturk_hit_settings,
}
#############################################################################




# # Liste des jeux
# games = [
#     'a3_gp',
#     'b3_bw',
#     'dictator_modif_asso',
#     'dictator_modif_class',
# ]
#
# # Mélanger l'ordre des jeux
# random.shuffle(games)


def custom_app_sequence(num_participants):
    # Define the tasks
    tasks = ['A', 'B', 'C', 'D']

    # Create a list to store randomized sequences for each participant
    participant_sequences = []

    # Generate a random sequence for each participant
    for _ in range(num_participants):
        participant_sequence = tasks[:]  # Copy the tasks list
        shuffle(participant_sequence)  # Shuffle the sequence for each participant
        participant_sequences.append(participant_sequence)

    return participant_sequences



SESSION_CONFIGS = [

    # dict(
    #     name='exp2_e4c',
    #     display_name='exp2_e4c',
    #     num_demo_participants=1,
    #     app_sequence=['a3_welcome',
    #                   'a1_en_p1_quest',
    #                   'a3_gp',
    #                   'b3_bw',
    #                   'dictator_modif_asso',
    #                   'dictator_modif_class',
    #                   'a5_questfin',
    #                   ],
    # ),  #
    #
    # dict(
    #     name='exp2_e4c_BOT',
    #     display_name='exp2_e4c_BOT',
    #     num_demo_participants=1,
    #     app_sequence=['a3_welcome',
    #                   'a1_en_p1_quest',
    #                   'a3_gp',
    #                   'b3_bw',
    #                   'dictator_modif_asso',
    #                   'dictator_modif_class',
    #                   'a5_questfin',
    #                   ],
    #     use_browser_bots=True,
    #
    # ),  #

    dict(
        name='exp2_e4c_random',
        display_name='exp2_e4c_random',
        num_demo_participants=1,
        app_sequence=['a3_welcome',
                      'a1_en_p1_quest',
                      'b3_bw_v2',  # game 2 (v2)
                      'a3_gp',  # game 1
                      'b3_bw',  # game 2
                      'dictator_modif_class_v2',  # game 4 (v2)
                      'dictator_modif_asso',  # game 3
                      'dictator_modif_class',  # game 4
                      'a1_en_p1_quest_v2',  # questionnaire (after)
                      'a5_questfin',
                      ],
    ),  #


    dict(
        name='exp2_e4c_random_BOT',
        display_name='exp2_e4c_random_BOT',
        num_demo_participants=1,
        app_sequence=['a3_welcome',
                      'a1_en_p1_quest',
                      'b3_bw_v2',             # game 2 (v2)
                      'a3_gp',                # game 1
                      'b3_bw',                # game 2
                      'dictator_modif_class_v2', # game 4 (v2)
                      'dictator_modif_asso',  # game 3
                      'dictator_modif_class', # game 4
                      'a1_en_p1_quest_v2',       # questionnaire (after)
                      'a5_questfin',
                      ],
        use_browser_bots=True,

    ),  #




    # dict(
    #     name='trust',
    #     display_name='trust',
    #     num_demo_participants=2,
    #     app_sequence=['trust',
    #                   ],
    # ),
    #
    # dict(
    #     name='exp_e4c_final_FR_EN_MAY_2022',
    #     display_name='exp_e4c_final_FR_EN_MAY_2022',
    #     num_demo_participants=1,
    #     app_sequence=[
    #         'v2_exp_e4c_a_p0',
    #
    #         'v2_exp_e4c_fr_p2_risk_gneezy',
    #         'v2_exp_e4c_fr_p3_risk_binswanger',
    #         'v2_exp_e4c_fr_p2bis_risk_gneezy_end',
    #         'v2_exp_e4c_fr_p1_quest',
    #         'v2_exp_e4c_fr_p5_questfin',
    #
    #         'v2_exp_e4c_en_p2_risk_gneezy',
    #         'v2_exp_e4c_en_p3_risk_binswanger',
    #         'v2_exp_e4c_en_p2bis_risk_gneezy_end',
    #         'v2_exp_e4c_en_p1_quest',
    #         'v2_exp_e4c_en_p5_questfin',
    #         'v2_exp_e4c_x_fr_en_fin',
    #
    #     ],
    #
    # ),  #
    #
    # dict(
    #     name='exp_e4c_final_FR_EN_MAY_2022_BOT',
    #     display_name='exp_e4c_final_FR_EN_MAY_2022_BOT',
    #     num_demo_participants=1,
    #     app_sequence=[
    #         'v2_exp_e4c_a_p0',
    #
    #         'v2_exp_e4c_fr_p2_risk_gneezy',
    #         'v2_exp_e4c_fr_p3_risk_binswanger',
    #         'v2_exp_e4c_fr_p2bis_risk_gneezy_end',
    #         'v2_exp_e4c_fr_p1_quest',
    #         'v2_exp_e4c_fr_p5_questfin',
    #
    #         'v2_exp_e4c_en_p2_risk_gneezy',
    #         'v2_exp_e4c_en_p3_risk_binswanger',
    #         'v2_exp_e4c_en_p2bis_risk_gneezy_end',
    #         'v2_exp_e4c_en_p1_quest',
    #         'v2_exp_e4c_en_p5_questfin',
    #         'v2_exp_e4c_x_fr_en_fin',
    #
    #
    #     ],
    #     use_browser_bots=True,
    # ),  #

    # dict(
    #     name='dictator_modif',
    #     display_name='dictator_modif',
    #     num_demo_participants=2,
    #     app_sequence=['dictator_modif',
    #                   ],
    # ),
    #
    # dict(
    #     name='GAME_1_GP_test',
    #     display_name='GAME_1_GP_test',
    #     num_demo_participants=1,
    #     app_sequence=[
    #         'a3_gp',
    #     ],
    # ),  #
    #
    # dict(
    #     name='GAME_1_GP_test_BOT',
    #     display_name='GAME_1_GP_test_BOT',
    #     num_demo_participants=1,
    #     app_sequence=[
    #         'a3_gp',
    #     ],
    #     use_browser_bots=True,
    # ),  #
    #
    # dict(
    #     name='GAME_2_BW_test',
    #     display_name='GAME_2_BW_test',
    #     num_demo_participants=1,
    #     app_sequence=[
    #         'b3_bw',
    #     ],
    # ),  #
    #
    # dict(
    #     name='GAME_3_BW_test_BOT',
    #     display_name='GAME_3_BW_test_BOT',
    #     num_demo_participants=1,
    #     app_sequence=[
    #         'b3_bw',
    #     ],
    #     use_browser_bots=True,
    # ),  #
    #
    # dict(
    #     name='GAME_3_dictator_modif_asso',
    #     display_name='GAME_3_dictator_modif_asso',
    #     num_demo_participants=1,
    #     app_sequence=['dictator_modif_asso',
    #                   ],
    # ),
    #
    # dict(
    #     name='GAME_3_dictator_modif_asso_BOT',
    #     display_name='GAME_3_dictator_modif_asso_BOT',
    #     num_demo_participants=1,
    #     app_sequence=['dictator_modif_asso',
    #                   ],
    #     use_browser_bots=True,
    # ),
    #
    # dict(
    #     name='GAME_4_dictator_modif_class',
    #     display_name='GAME_4_dictator_modif_class',
    #     num_demo_participants=1,
    #     app_sequence=['dictator_modif_class',
    #                   ],
    # ),
    #
    # dict(
    #     name='GAME_4_dictator_modif_class_BOT',
    #     display_name='GAME_4_dictator_modif_class_BOT',
    #     num_demo_participants=1,
    #     app_sequence=['dictator_modif_class',
    #                   ],
    #     use_browser_bots=True,
    # ),

    # dict(
    #     name='dictator_one_shot',
    #     display_name="Dictator game (10 rounds, different players)",
    #     app_sequence=['dictator', 'payment_info'],
    #     num_demo_participants=2,
    # ),



]



# ISO-639 code
# for example: de, fr, ja, ko, zh-hans
LANGUAGE_CODE = 'en'      #en                    # 'fr'  pour Exp Mindfullness et exp police

# e.g. EUR, GBP, CNY, JPY
REAL_WORLD_CURRENCY_CODE = 'USD'              # EUR pour Exp Mindfullness
USE_POINTS = True # False

ROOMS = [
    dict(
        name="labeds",
        display_name="labeds",
        participant_label_file="_rooms/labeds.txt"
    ),
]

#ADMIN_USERNAME = 'admin'
ADMIN_USERNAME = 'wael bousselmi'
# for security, best to set admin password in an environment variable
ADMIN_PASSWORD = environ.get('OTREE_ADMIN_PASSWORD')


DEMO_PAGE_INTRO_HTML = """
Here are some oTree games.
"""

# don't share this with anybody.
SECRET_KEY = 'nm5eaornndp(_0bt_64k+03(-f-n%4bir_+==$8i7&-o$th2@)'

# List of additional apps besides otree default apps
INSTALLED_APPS = ['otree', 'a3_welcome', 'a3_gp', 'b3_bw', 'dictator_modif_asso', 'dictator_modif_class']



AWS_ACCESS_KEY_ID = environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = environ.get('AWS_SECRET_ACCESS_KEY')










