# Generated by Django 5.2.1 on 2026-01-14 11:27

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('cms', '0015_add_ab_testing_models'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='abtestview',
            name='variant',
        ),
        migrations.CreateModel(
            name='ConversionMetric',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField(help_text='Date of the conversion data')),
                ('conversion_type', models.CharField(choices=[('contact_form', 'Contact Form'), ('phone_call', 'Phone Call'), ('demo_request', 'Demo Request'), ('quote_request', 'Quote Request'), ('newsletter_signup', 'Newsletter Signup'), ('download', 'Download'), ('other', 'Other')], help_text='Type of conversion', max_length=50)),
                ('total_conversions', models.IntegerField(default=0, help_text='Total number of conversions')),
                ('conversion_value', models.FloatField(default=0.0, help_text='Total conversion value')),
                ('avg_conversion_value', models.FloatField(default=0.0, help_text='Average conversion value')),
                ('organic_conversions', models.IntegerField(default=0, help_text='Conversions from organic traffic')),
                ('paid_conversions', models.IntegerField(default=0, help_text='Conversions from paid traffic')),
                ('direct_conversions', models.IntegerField(default=0, help_text='Conversions from direct traffic')),
                ('recorded_at', models.DateTimeField(auto_now_add=True, help_text='When this data was recorded')),
            ],
            options={
                'verbose_name': 'Conversion Metric',
                'verbose_name_plural': 'Conversion Metrics',
                'ordering': ['-date', 'conversion_type'],
                'indexes': [models.Index(fields=['-date', 'conversion_type'], name='cms_convers_date_fb8dfc_idx')],
                'unique_together': {('date', 'conversion_type')},
            },
        ),
        migrations.CreateModel(
            name='CoreWebVital',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('page_url', models.URLField(help_text='URL of the page')),
                ('date', models.DateField(help_text='Date of the measurement')),
                ('lcp', models.FloatField(help_text='Largest Contentful Paint (LCP) in seconds')),
                ('fid', models.FloatField(help_text='First Input Delay (FID) in milliseconds')),
                ('cls', models.FloatField(help_text='Cumulative Layout Shift (CLS) score')),
                ('overall_score', models.IntegerField(default=0, help_text='Overall PageSpeed score (0-100)')),
                ('lcp_status', models.CharField(choices=[('good', 'Good'), ('needs_improvement', 'Needs Improvement'), ('poor', 'Poor')], help_text='LCP status', max_length=20)),
                ('fid_status', models.CharField(choices=[('good', 'Good'), ('needs_improvement', 'Needs Improvement'), ('poor', 'Poor')], help_text='FID status', max_length=20)),
                ('cls_status', models.CharField(choices=[('good', 'Good'), ('needs_improvement', 'Needs Improvement'), ('poor', 'Poor')], help_text='CLS status', max_length=20)),
                ('recorded_at', models.DateTimeField(auto_now_add=True, help_text='When this data was recorded')),
            ],
            options={
                'verbose_name': 'Core Web Vital',
                'verbose_name_plural': 'Core Web Vitals',
                'ordering': ['-date', 'page_url'],
                'indexes': [models.Index(fields=['page_url', '-date'], name='cms_coreweb_page_ur_a54b4d_idx')],
                'unique_together': {('page_url', 'date')},
            },
        ),
        migrations.CreateModel(
            name='CrawlError',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('error_url', models.URLField(help_text='URL that caused the error')),
                ('error_type', models.CharField(choices=[('404', '404 Not Found'), ('500', '500 Server Error'), ('403', '403 Forbidden'), ('timeout', 'Timeout'), ('redirect_error', 'Redirect Error'), ('ssl_error', 'SSL Error'), ('other', 'Other')], help_text='Type of error', max_length=50)),
                ('error_message', models.TextField(blank=True, help_text='Error message details')),
                ('http_status_code', models.IntegerField(blank=True, help_text='HTTP status code', null=True)),
                ('first_detected', models.DateTimeField(auto_now_add=True, help_text='When the error was first detected')),
                ('last_detected', models.DateTimeField(auto_now=True, help_text='When the error was last detected')),
                ('is_resolved', models.BooleanField(default=False, help_text='Has the error been resolved?')),
                ('resolved_date', models.DateTimeField(blank=True, help_text='When the error was resolved', null=True)),
            ],
            options={
                'verbose_name': 'Crawl Error',
                'verbose_name_plural': 'Crawl Errors',
                'ordering': ['-last_detected'],
                'indexes': [models.Index(fields=['error_type', '-last_detected'], name='cms_crawler_error_t_e0d7aa_idx'), models.Index(fields=['is_resolved', '-last_detected'], name='cms_crawler_is_reso_f844fa_idx')],
            },
        ),
        migrations.CreateModel(
            name='KeywordRanking',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('keyword', models.CharField(help_text='Target keyword', max_length=255)),
                ('search_engine', models.CharField(choices=[('google', 'Google'), ('bing', 'Bing'), ('yahoo', 'Yahoo')], default='google', help_text='Search engine', max_length=50)),
                ('current_rank', models.IntegerField(help_text='Current ranking position (1-100+)')),
                ('previous_rank', models.IntegerField(blank=True, help_text='Previous ranking position', null=True)),
                ('target_url', models.URLField(help_text='URL being ranked')),
                ('search_volume', models.IntegerField(default=0, help_text='Monthly search volume')),
                ('keyword_difficulty', models.IntegerField(default=0, help_text='Keyword difficulty score (0-100)')),
                ('tracked_date', models.DateTimeField(auto_now_add=True, help_text='When this ranking was recorded')),
            ],
            options={
                'verbose_name': 'Keyword Ranking',
                'verbose_name_plural': 'Keyword Rankings',
                'ordering': ['keyword', '-tracked_date'],
                'indexes': [models.Index(fields=['keyword', '-tracked_date'], name='cms_keyword_keyword_6c5292_idx'), models.Index(fields=['search_engine', '-tracked_date'], name='cms_keyword_search__613899_idx')],
            },
        ),
        migrations.CreateModel(
            name='OrganicTraffic',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField(help_text='Date of the traffic data')),
                ('sessions', models.IntegerField(default=0, help_text='Number of organic sessions')),
                ('users', models.IntegerField(default=0, help_text='Number of unique users')),
                ('pageviews', models.IntegerField(default=0, help_text='Number of pageviews')),
                ('bounce_rate', models.FloatField(default=0.0, help_text='Bounce rate percentage')),
                ('avg_session_duration', models.FloatField(default=0.0, help_text='Average session duration in seconds')),
                ('conversions', models.IntegerField(default=0, help_text='Number of conversions')),
                ('conversion_rate', models.FloatField(default=0.0, help_text='Conversion rate percentage')),
                ('mobile_sessions', models.IntegerField(default=0, help_text='Mobile sessions')),
                ('desktop_sessions', models.IntegerField(default=0, help_text='Desktop sessions')),
                ('tablet_sessions', models.IntegerField(default=0, help_text='Tablet sessions')),
                ('recorded_at', models.DateTimeField(auto_now_add=True, help_text='When this data was recorded')),
            ],
            options={
                'verbose_name': 'Organic Traffic',
                'verbose_name_plural': 'Organic Traffic',
                'ordering': ['-date'],
                'indexes': [models.Index(fields=['-date'], name='cms_organic_date_4ef95c_idx')],
                'unique_together': {('date',)},
            },
        ),
        migrations.CreateModel(
            name='SEOAlert',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('alert_type', models.CharField(choices=[('ranking_drop', 'Ranking Drop'), ('traffic_drop', 'Traffic Drop'), ('crawl_error', 'Crawl Error'), ('core_web_vitals', 'Core Web Vitals Issue'), ('indexation', 'Indexation Issue'), ('security', 'Security Issue'), ('other', 'Other')], help_text='Type of alert', max_length=50)),
                ('severity', models.CharField(choices=[('critical', 'Critical'), ('high', 'High'), ('medium', 'Medium'), ('low', 'Low')], default='medium', help_text='Severity level', max_length=20)),
                ('title', models.CharField(help_text='Alert title', max_length=255)),
                ('description', models.TextField(help_text='Alert description')),
                ('affected_url', models.URLField(blank=True, help_text='URL affected by the alert')),
                ('affected_keyword', models.CharField(blank=True, help_text='Keyword affected by the alert', max_length=255)),
                ('metric_value', models.FloatField(blank=True, help_text='Metric value that triggered the alert', null=True)),
                ('threshold_value', models.FloatField(blank=True, help_text='Threshold that was exceeded', null=True)),
                ('is_active', models.BooleanField(default=True, help_text='Is the alert currently active?')),
                ('is_acknowledged', models.BooleanField(default=False, help_text='Has the alert been acknowledged?')),
                ('is_resolved', models.BooleanField(default=False, help_text='Has the alert been resolved?')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='When the alert was created')),
                ('acknowledged_at', models.DateTimeField(blank=True, help_text='When the alert was acknowledged', null=True)),
                ('resolved_at', models.DateTimeField(blank=True, help_text='When the alert was resolved', null=True)),
            ],
            options={
                'verbose_name': 'SEO Alert',
                'verbose_name_plural': 'SEO Alerts',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['alert_type', '-created_at'], name='cms_seoaler_alert_t_b62dc7_idx'), models.Index(fields=['severity', '-created_at'], name='cms_seoaler_severit_eb2555_idx'), models.Index(fields=['is_active', '-created_at'], name='cms_seoaler_is_acti_30a0ca_idx')],
            },
        ),
        migrations.CreateModel(
            name='SEODashboardMetrics',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField(help_text='Date of the metrics', unique=True)),
                ('organic_traffic', models.IntegerField(default=0, help_text='Total organic traffic')),
                ('organic_traffic_change', models.FloatField(default=0.0, help_text='Percentage change from previous day')),
                ('keywords_top_10', models.IntegerField(default=0, help_text='Number of keywords in top 10')),
                ('keywords_top_3', models.IntegerField(default=0, help_text='Number of keywords in top 3')),
                ('keywords_top_1', models.IntegerField(default=0, help_text='Number of keywords in position 1')),
                ('total_conversions', models.IntegerField(default=0, help_text='Total conversions')),
                ('conversion_rate', models.FloatField(default=0.0, help_text='Conversion rate percentage')),
                ('avg_lcp', models.FloatField(default=0.0, help_text='Average LCP across all pages')),
                ('avg_fid', models.FloatField(default=0.0, help_text='Average FID across all pages')),
                ('avg_cls', models.FloatField(default=0.0, help_text='Average CLS across all pages')),
                ('total_crawl_errors', models.IntegerField(default=0, help_text='Total number of crawl errors')),
                ('new_crawl_errors', models.IntegerField(default=0, help_text='New crawl errors since last day')),
                ('active_alerts', models.IntegerField(default=0, help_text='Number of active alerts')),
                ('critical_alerts', models.IntegerField(default=0, help_text='Number of critical alerts')),
                ('recorded_at', models.DateTimeField(auto_now_add=True, help_text='When this data was recorded')),
            ],
            options={
                'verbose_name': 'SEO Dashboard Metrics',
                'verbose_name_plural': 'SEO Dashboard Metrics',
                'ordering': ['-date'],
                'indexes': [models.Index(fields=['-date'], name='cms_seodash_date_4d3d8a_idx')],
            },
        ),
        migrations.DeleteModel(
            name='ABTestConversion',
        ),
        migrations.DeleteModel(
            name='ABTestVariant',
        ),
        migrations.DeleteModel(
            name='ABTestView',
        ),
    ]
