# Generated by Django 6.0.6 on 2026-08-03 07:06

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


class Migration(migrations.Migration):

    dependencies = [
        ('jobs', '0022_alter_jobposting_channel'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='JobTrackingLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(db_index=True, max_length=32, unique=True)),
                ('channel', models.CharField(choices=[('LINKEDIN', 'LinkedIn'), ('NAUKRI', 'Naukri'), ('CAREER_PORTAL', 'Career Portal'), ('WHATSAPP', 'WhatsApp'), ('SMS', 'SMS'), ('TELEGRAM', 'Telegram'), ('OTHER', 'Other')], max_length=20)),
                ('label', models.CharField(blank=True, default='', help_text='Optional campaign label — lets one platform have several distinct links.', max_length=100)),
                ('tracking', models.JSONField(blank=True, default=dict, help_text='Free-form tracking metadata resolved alongside the JD and channel.')),
                ('use_count', models.PositiveIntegerField(default=0)),
                ('last_used_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(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='job_tracking_links_made', to=settings.AUTH_USER_MODEL)),
                ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tracking_links', to='jobs.jobdescription')),
            ],
            options={
                'db_table': 'job_tracking_links',
                'ordering': ['job', 'channel'],
                'unique_together': {('job', 'channel', 'label')},
            },
        ),
    ]
