# Generated by Django 6.0 on 2026-04-13 16:37

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


def seed_enterprise_request_call_cta(apps, schema_editor):
    CallToAction = apps.get_model('pages', 'CallToAction')
    CallToActionVersion = apps.get_model('pages', 'CallToActionVersion')

    cta, _ = CallToAction.objects.get_or_create(
        slug='cta_enterprise_request_call',
        defaults={
            'description': 'Enterprise request-a-call CTA used on pricing and pre-qualification pages.',
        },
    )
    if not CallToActionVersion.objects.filter(cta=cta).exists():
        CallToActionVersion.objects.create(
            cta=cta,
            text='Request a call',
        )


class Migration(migrations.Migration):

    dependencies = [
        ('pages', '0005_minimodecampaignpattern'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='CallToAction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(help_text="Stable identifier used in templates, for example 'cta_homepage_main'.", max_length=128, unique=True)),
                ('description', models.TextField(help_text='Human-readable explanation of where this CTA is used.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'CTA',
                'verbose_name_plural': 'CTAs',
                'ordering': ('slug',),
            },
        ),
        migrations.CreateModel(
            name='CallToActionVersion',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(help_text='The customer-facing CTA text rendered in templates.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(blank=True, help_text='Admin user who created this CTA version.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_cta_versions', to=settings.AUTH_USER_MODEL)),
                ('cta', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='pages.calltoaction')),
            ],
            options={
                'verbose_name': 'CTA version',
                'verbose_name_plural': 'CTA versions',
                'ordering': ('-created_at', '-id'),
            },
        ),
        migrations.RunPython(seed_enterprise_request_call_cta, migrations.RunPython.noop),
    ]
