# Generated by Django 5.2 on 2025-06-16 16:07

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0020_cleanup_django_celery_beat_tables'),
    ]

    operations = [
        migrations.CreateModel(
            name='DecodoCredential',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('username', models.CharField(max_length=128)),
                ('password', models.CharField(max_length=128)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['-created_at'],
                'constraints': [models.UniqueConstraint(fields=('username',), name='unique_decodo_credential_username')],
            },
        ),
        migrations.CreateModel(
            name='DecodoIPBlock',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('block_size', models.PositiveIntegerField(help_text='Number of IPs in this block (e.g. 50)')),
                ('endpoint', models.CharField(help_text="Proxy endpoint (e.g. 'isp.decodo.com')", max_length=256)),
                ('start_port', models.PositiveIntegerField(help_text='Starting port number (e.g. 10001)')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('credential', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ip_blocks', to='api.decodocredential')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='DecodoIP',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('ip_address', models.GenericIPAddressField()),
                ('isp_name', models.CharField(blank=True, max_length=256)),
                ('isp_asn', models.PositiveIntegerField(blank=True, null=True)),
                ('isp_domain', models.CharField(blank=True, max_length=256)),
                ('isp_organization', models.CharField(blank=True, max_length=256)),
                ('city_name', models.CharField(blank=True, max_length=256)),
                ('city_code', models.CharField(blank=True, max_length=32)),
                ('city_state', models.CharField(blank=True, max_length=256)),
                ('city_timezone', models.CharField(blank=True, max_length=64)),
                ('city_zip_code', models.CharField(blank=True, max_length=32)),
                ('city_latitude', models.FloatField(blank=True, null=True)),
                ('city_longitude', models.FloatField(blank=True, null=True)),
                ('country_code', models.CharField(blank=True, max_length=8)),
                ('country_name', models.CharField(blank=True, max_length=256)),
                ('country_continent', models.CharField(blank=True, max_length=256)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('ip_block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ip_addresses', to='api.decodoipblock')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddIndex(
            model_name='decodoipblock',
            index=models.Index(fields=['endpoint'], name='api_decodoi_endpoin_344e0c_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoipblock',
            index=models.Index(fields=['start_port'], name='api_decodoi_start_p_b46f75_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['ip_address'], name='api_decodoi_ip_addr_53c233_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['country_code'], name='api_decodoi_country_c0d899_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['country_name'], name='api_decodoi_country_913959_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['isp_name'], name='api_decodoi_isp_nam_5e313e_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['isp_asn'], name='api_decodoi_isp_asn_c3ed14_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['city_name'], name='api_decodoi_city_na_d52f21_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['city_state'], name='api_decodoi_city_st_eec373_idx'),
        ),
        migrations.AddIndex(
            model_name='decodoip',
            index=models.Index(fields=['city_latitude', 'city_longitude'], name='api_decodoi_city_la_7b6949_idx'),
        ),
        migrations.AddConstraint(
            model_name='decodoip',
            constraint=models.UniqueConstraint(fields=('ip_address',), name='unique_decodo_ip_address'),
        ),
    ]
