# Generated by Django 6.0.4 on 2026-06-06 02:55

import apps.tools.models
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CurrencyRate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('base', models.CharField(max_length=3)),
                ('quote', models.CharField(max_length=3)),
                ('date', models.DateField()),
                ('rate', models.DecimalField(decimal_places=8, max_digits=20)),
                ('fetched_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'tools_currency_rates',
                'ordering': ['date'],
                'indexes': [models.Index(fields=['base', 'quote', 'date'], name='tools_curre_base_b32594_idx')],
                'constraints': [models.UniqueConstraint(fields=('base', 'quote', 'date'), name='uniq_currency_rate')],
            },
        ),
        migrations.CreateModel(
            name='FileConversion',
            fields=[
                ('id', models.UUIDField(default=apps.tools.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('from_format', models.CharField(choices=[('pdf', 'PDF'), ('jpg', 'JPEG'), ('png', 'PNG'), ('docx', 'Word'), ('xlsx', 'Excel')], max_length=10)),
                ('to_format', models.CharField(choices=[('pdf', 'PDF'), ('jpg', 'JPEG'), ('png', 'PNG'), ('docx', 'Word'), ('xlsx', 'Excel')], max_length=10)),
                ('original_filename', models.CharField(max_length=255)),
                ('result_filename', models.CharField(blank=True, max_length=255)),
                ('original_size', models.PositiveIntegerField(default=0)),
                ('result_size', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='file_conversions', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'tools_file_conversions',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ImageToolUsage',
            fields=[
                ('id', models.UUIDField(default=apps.tools.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('tool_name', models.CharField(max_length=50)),
                ('original_filename', models.CharField(blank=True, max_length=255)),
                ('result_filename', models.CharField(blank=True, max_length=255)),
                ('original_size', models.PositiveIntegerField(default=0)),
                ('result_size', models.PositiveIntegerField(default=0)),
                ('compression_ratio', models.FloatField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_tool_usages', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'tools_image_usage',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='QRCode',
            fields=[
                ('id', models.UUIDField(default=apps.tools.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('content', models.TextField()),
                ('short_code', models.CharField(blank=True, max_length=20, unique=True)),
                ('title', models.CharField(blank=True, max_length=255)),
                ('size', models.PositiveIntegerField(default=300)),
                ('format', models.CharField(default='png', max_length=10)),
                ('downloads', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qr_codes', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'tools_qr_codes',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='URL',
            fields=[
                ('id', models.UUIDField(default=apps.tools.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('original_url', models.URLField(max_length=2048)),
                ('short_code', models.CharField(blank=True, max_length=20, unique=True)),
                ('title', models.CharField(blank=True, max_length=255)),
                ('clicks', models.PositiveIntegerField(default=0)),
                ('last_clicked_at', models.DateTimeField(blank=True, null=True)),
                ('expires_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='shortened_urls', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'tools_urls',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='URLClick',
            fields=[
                ('id', models.UUIDField(default=apps.tools.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('clicked_at', models.DateTimeField(auto_now_add=True)),
                ('ip_address', models.GenericIPAddressField(blank=True, null=True)),
                ('user_agent', models.CharField(blank=True, max_length=512)),
                ('referer', models.URLField(blank=True, max_length=2048)),
                ('url', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='click_logs', to='tools.url')),
            ],
            options={
                'db_table': 'tools_url_clicks',
                'ordering': ['-clicked_at'],
            },
        ),
    ]
