# Generated by Django 5.1.4 on 2026-07-18 13:15

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('tenants', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='InsightCategory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(max_length=120)),
                ('order', models.PositiveIntegerField(default=1)),
                ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='insight_categories', to='tenants.tenant')),
            ],
            options={
                'verbose_name': 'Insight Category',
                'verbose_name_plural': 'Insight Categories',
                'ordering': ['order'],
                'unique_together': {('tenant', 'slug')},
            },
        ),
        migrations.CreateModel(
            name='Insight',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=300)),
                ('slug', models.SlugField(blank=True, max_length=350)),
                ('excerpt', models.TextField(help_text='Short summary shown on cards and homepage')),
                ('body', django_ckeditor_5.fields.CKEditor5Field()),
                ('thumbnail', models.ImageField(upload_to='insights/')),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published')], default='draft', max_length=20)),
                ('published_at', models.DateTimeField(blank=True, null=True)),
                ('meta_description', models.TextField(blank=True)),
                ('read_time', models.PositiveIntegerField(default=3, help_text='Estimated read time in minutes')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='insights', to='tenants.tenant')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='insights.insightcategory')),
            ],
            options={
                'verbose_name': 'Insight',
                'verbose_name_plural': 'Insights',
                'ordering': ['-published_at', '-created_at'],
                'unique_together': {('tenant', 'slug')},
            },
        ),
    ]
