# Generated by Django 5.2.11 on 2026-02-24 19:05

from django.db import migrations

from edc_list_data import site_list_data
from meta_subject.models import HivExitReview
from meta_lists.models import ArvRegimens


def update_taf_ld(apps, schema_editor):
    site_list_data.load_data()
    arv_regimen = ArvRegimens.objects.get(name="TAF_LD")
    for obj in HivExitReview.objects.filter(other_current_arv_regimen="TAF-LD"):
        obj.current_arv_regimen = arv_regimen
        obj.other_current_arv_regimen = None
        obj.save()
    arv_regimen = ArvRegimens.objects.get(name="ABC_3TC_DTG")
    for obj in HivExitReview.objects.filter(
            other_current_arv_regimen__in=["ABC+3TC+DTG", "ABC/3TC +DTG"]
    ):
        obj.current_arv_regimen = arv_regimen
        obj.other_current_arv_regimen = None
        obj.save()


class Migration(migrations.Migration):

    dependencies = [
        ("meta_subject", "0242_glucose_ogtt_diagnostic_device_and_more"),
    ]

    operations = [migrations.RunPython(update_taf_ld)]
