# Generated by Django 4.2.19 on 2025-03-12 15:53

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ("NEMO", "0106_toolusagecounter_tool_pre_post_usage_question"),
    ]

    def update_customization_remote_work_ask_explicitly(apps, schema_editor):
        Customization = apps.get_model("NEMO", "Customization")
        customization_behalf, created = Customization.objects.get_or_create(name="remote_work_ask_explicitly")
        customization_behalf.name = "remote_work_on_behalf_of_user"
        customization_behalf.value = "always" if created else "ask"
        customization_behalf.save()
        Customization.objects.filter(name="remote_work_ask_explicitly").delete()

    def update_customization_remote_work_ask_explicitly_reverse(apps, schema_editor):
        Customization = apps.get_model("NEMO", "Customization")
        customization_behalf = Customization.objects.filter(name="remote_work_on_behalf_of_user").first()
        if customization_behalf.value == "ask":
            customization_behalf.name = "remote_work_ask_explicitly"
            customization_behalf.value = "enabled"
            customization_behalf.save()
        else:
            customization_behalf.delete()
        Customization.objects.filter(name="remote_work_on_behalf_of_user").delete()

    operations = [
        migrations.RunPython(
            update_customization_remote_work_ask_explicitly, update_customization_remote_work_ask_explicitly_reverse
        )
    ]
