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

import django.db.models.deletion
import django.utils.timezone
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0035_add_default_health_check_spec'),
    ]

    operations = [
        migrations.CreateModel(
            name='ProxyHealthCheckResult',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('status', models.CharField(choices=[('PASSED', 'Passed'), ('FAILED', 'Failed'), ('ERROR', 'Error'), ('TIMEOUT', 'Timeout')], help_text='Result of the health check', max_length=8)),
                ('checked_at', models.DateTimeField(default=django.utils.timezone.now, help_text='When the check was performed')),
                ('response_time_ms', models.PositiveIntegerField(blank=True, help_text='Response time in milliseconds (if applicable)', null=True)),
                ('error_message', models.TextField(blank=True, help_text='Error details if the check failed')),
                ('task_result', models.JSONField(blank=True, help_text='Full task result data from the browser use agent', null=True)),
                ('notes', models.TextField(blank=True, help_text='Additional notes about this check')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('health_check_spec', models.ForeignKey(help_text='The health check specification that was used', on_delete=django.db.models.deletion.CASCADE, related_name='results', to='api.proxyhealthcheckspec')),
                ('proxy_server', models.ForeignKey(help_text='The proxy server that was tested', on_delete=django.db.models.deletion.CASCADE, related_name='health_check_results', to='api.proxyserver')),
            ],
            options={
                'ordering': ['-checked_at'],
                'indexes': [models.Index(fields=['proxy_server', '-checked_at'], name='api_proxyhe_proxy_s_be3834_idx'), models.Index(fields=['health_check_spec', '-checked_at'], name='api_proxyhe_health__f0609c_idx'), models.Index(fields=['status'], name='api_proxyhe_status_e4cdd3_idx'), models.Index(fields=['-checked_at'], name='api_proxyhe_checked_c83401_idx'), models.Index(fields=['proxy_server', 'status', '-checked_at'], name='proxy_status_recent_idx')],
                'constraints': [models.UniqueConstraint(fields=('proxy_server', 'health_check_spec', 'checked_at'), name='unique_proxy_spec_timestamp')],
            },
        ),
    ]
