# Generated by Django 5.2 on 2025-06-18 23:26

from django.db import migrations


def create_default_health_check_spec(apps, schema_editor):
    """Create the default Reddit health check spec"""
    ProxyHealthCheckSpec = apps.get_model('api', 'ProxyHealthCheckSpec')
    
    ProxyHealthCheckSpec.objects.get_or_create(
        name="Reddit Subreddit Visit",
        defaults={
            'prompt': "go to reddit and verify that you are able to visit a subreddit. output true if you are able to, false if you are blocked or fail.",
            'is_active': True,
        }
    )


def reverse_default_health_check_spec(apps, schema_editor):
    """Remove the default Reddit health check spec"""
    ProxyHealthCheckSpec = apps.get_model('api', 'ProxyHealthCheckSpec')
    
    ProxyHealthCheckSpec.objects.filter(
        name="Reddit Subreddit Visit"
    ).delete()


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0034_proxy_health_check_spec'),
    ]

    operations = [
        migrations.RunPython(
            create_default_health_check_spec,
            reverse_default_health_check_spec,
        ),
    ]
