# Generated by Django 5.2.7 on 2025-11-03 13:22

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('igny8_core_auth', '0003_alter_user_role'),
        ('planner', '0003_alter_clusters_sector_alter_clusters_site_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='Tasks',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(db_index=True, max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('keywords', models.CharField(blank=True, max_length=500)),
                ('content_structure', models.CharField(choices=[('cluster_hub', 'Cluster Hub'), ('landing_page', 'Landing Page'), ('pillar_page', 'Pillar Page'), ('supporting_page', 'Supporting Page')], default='blog_post', max_length=50)),
                ('content_type', models.CharField(choices=[('blog_post', 'Blog Post'), ('article', 'Article'), ('guide', 'Guide'), ('tutorial', 'Tutorial')], default='blog_post', max_length=50)),
                ('status', models.CharField(choices=[('queued', 'Queued'), ('in_progress', 'In Progress'), ('draft', 'Draft'), ('review', 'Review'), ('published', 'Published'), ('completed', 'Completed')], default='queued', max_length=50)),
                ('content', models.TextField(blank=True, null=True)),
                ('word_count', models.IntegerField(default=0)),
                ('meta_title', models.CharField(blank=True, max_length=255, null=True)),
                ('meta_description', models.TextField(blank=True, null=True)),
                ('assigned_post_id', models.IntegerField(blank=True, null=True)),
                ('post_url', models.URLField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('cluster', models.ForeignKey(blank=True, limit_choices_to={'sector': models.F('sector')}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tasks', to='planner.clusters')),
                ('idea', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tasks', to='planner.contentideas')),
                ('sector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.sector')),
                ('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.site')),
                ('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
            ],
            options={
                'db_table': 'igny8_tasks',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='TaskImages',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image_type', models.CharField(choices=[('featured', 'Featured Image'), ('desktop', 'Desktop Image'), ('mobile', 'Mobile Image'), ('in_article', 'In-Article Image')], default='featured', max_length=50)),
                ('image_url', models.URLField(blank=True, null=True)),
                ('image_path', models.CharField(blank=True, max_length=500, null=True)),
                ('prompt', models.TextField(blank=True, null=True)),
                ('status', models.CharField(default='pending', max_length=50)),
                ('position', models.IntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('sector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.sector')),
                ('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.site')),
                ('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_set', to='igny8_core_auth.tenant')),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='writer.tasks')),
            ],
            options={
                'db_table': 'igny8_task_images',
                'ordering': ['task', 'position', '-created_at'],
            },
        ),
        migrations.AddIndex(
            model_name='tasks',
            index=models.Index(fields=['title'], name='igny8_tasks_title_adc50b_idx'),
        ),
        migrations.AddIndex(
            model_name='tasks',
            index=models.Index(fields=['status'], name='igny8_tasks_status_706869_idx'),
        ),
        migrations.AddIndex(
            model_name='tasks',
            index=models.Index(fields=['cluster'], name='igny8_tasks_cluster_ac6cd4_idx'),
        ),
        migrations.AddIndex(
            model_name='tasks',
            index=models.Index(fields=['content_type'], name='igny8_tasks_content_343539_idx'),
        ),
        migrations.AddIndex(
            model_name='tasks',
            index=models.Index(fields=['site', 'sector'], name='igny8_tasks_site_id_9880f4_idx'),
        ),
        migrations.AddIndex(
            model_name='taskimages',
            index=models.Index(fields=['task', 'image_type'], name='igny8_task__task_id_143db4_idx'),
        ),
        migrations.AddIndex(
            model_name='taskimages',
            index=models.Index(fields=['status'], name='igny8_task__status_4f869f_idx'),
        ),
    ]
