# Generated by Django 5.2.9 on 2025-12-29 18:58

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ScrapeConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True)),
                ('default_url', models.URLField(blank=True)),
                ('javascript_enabled', models.BooleanField(default=True)),
                ('wait_for_selector', models.CharField(blank=True, max_length=500)),
                ('wait_timeout', models.IntegerField(default=30)),
                ('proxy_url', models.CharField(blank=True, max_length=500)),
                ('proxy_country', models.CharField(blank=True, max_length=2)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Scrape Configuration',
                'verbose_name_plural': 'Scrape Configurations',
                'ordering': ['-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='InstructionModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Field name in output', max_length=100)),
                ('selector', models.TextField(help_text='CSS selector, XPath, regex pattern, etc.')),
                ('method', models.CharField(choices=[('css', 'CSS Selector'), ('xpath', 'XPath'), ('regex', 'Regex'), ('text', 'Text Search'), ('meta', 'Meta Tag')], default='css', max_length=20)),
                ('multiple', models.BooleanField(default=False, help_text='Return list vs single value')),
                ('attribute', models.CharField(blank=True, help_text="Extract attribute instead of text (e.g., 'href', 'src')", max_length=100)),
                ('default_value', models.TextField(blank=True, help_text='Default value if not found')),
                ('required', models.BooleanField(default=False, help_text='Raise error if not found')),
                ('transform', models.CharField(blank=True, choices=[('', 'None'), ('lowercase', 'Lowercase'), ('uppercase', 'Uppercase'), ('int', 'Integer'), ('float', 'Float'), ('clean', 'Clean Whitespace'), ('bool', 'Boolean')], help_text='Transform the extracted value', max_length=50)),
                ('order', models.IntegerField(default=0, help_text='Order in which instructions are processed')),
                ('config', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='instructions', to='yoinkr.scrapeconfig')),
            ],
            options={
                'verbose_name': 'Extraction Instruction',
                'verbose_name_plural': 'Extraction Instructions',
                'ordering': ['order', 'id'],
            },
        ),
    ]
