# Generated by Django 6.0.1 on 2026-05-11 20:32

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Presentation',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(max_length=300)),
                ('subtitle', models.CharField(blank=True, max_length=500)),
                ('description', models.TextField(blank=True)),
                ('theme', models.CharField(choices=[('healthcare_modern', 'Healthcare Modern'), ('corporate_navy', 'Corporate Navy'), ('dark_command', 'Dark Command Center')], default='healthcare_modern', max_length=30)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published'), ('archived', 'Archived')], default='draft', max_length=20)),
                ('presentation_type', models.CharField(blank=True, help_text='Type of report (e.g., quarterly, monthly, custom)', max_length=50)),
                ('thumbnail', models.ImageField(blank=True, null=True, upload_to='presentations/thumbnails/')),
                ('presentation_date', models.DateField(blank=True, null=True)),
                ('is_shared', models.BooleanField(default=False)),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='presentations', to=settings.AUTH_USER_MODEL)),
                ('hospital', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='presentations', to='organizations.hospital')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ReportTemplate',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=200)),
                ('slug', models.SlugField(max_length=220, unique=True)),
                ('description', models.TextField(blank=True)),
                ('data_source', models.CharField(help_text='Key in REPORT_DATA_SOURCES registry', max_length=50)),
                ('reference_pdf', models.FileField(blank=True, null=True, upload_to='report_templates/')),
                ('parsed_structure', models.JSONField(blank=True, default=dict, help_text='Raw AI analysis of the reference PDF')),
                ('style_config', models.JSONField(blank=True, default=dict, help_text='Theme colors, row colors, fonts')),
                ('ai_prompt_template', models.TextField(blank=True, help_text='Prompt template for AI insight generation. Use {{ data_summary }} placeholder.')),
                ('active', models.BooleanField(default=True)),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='report_templates', to=settings.AUTH_USER_MODEL)),
                ('hospital', models.ForeignKey(blank=True, help_text='Null = available for all hospitals', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='report_templates', to='organizations.hospital')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='ReportTemplateSlide',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('order', models.PositiveIntegerField(default=0)),
                ('layout', models.CharField(choices=[('cover', 'Cover'), ('section_divider', 'Section Divider'), ('kpi_dashboard', 'KPI Dashboard'), ('full_chart', 'Full Chart'), ('chart_metrics', 'Chart + Metrics'), ('data_table', 'Data Table'), ('two_column', 'Two Column'), ('quote', 'Quote / Callout'), ('timeline', 'Timeline'), ('comparison', 'Comparison'), ('team_grid', 'Team / Department Grid'), ('closing', 'Closing')], default='cover', max_length=30)),
                ('section_label', models.CharField(blank=True, help_text='For section dividers: e.g. "01", "02"', max_length=50)),
                ('title_template', models.CharField(blank=True, help_text='Supports {{ variable }} substitution', max_length=300)),
                ('subtitle_template', models.CharField(blank=True, help_text='Supports {{ variable }} substitution', max_length=500)),
                ('content_mapping', models.JSONField(blank=True, default=dict, help_text='How data maps to slide content. Structure depends on layout type.')),
                ('repeat_source', models.CharField(blank=True, help_text='Data key to repeat over, e.g. "by_department". Creates one slide per item.', max_length=100)),
                ('repeat_title_key', models.CharField(blank=True, default='name', help_text='Key in repeat item for slide title, e.g. "department_name"', max_length=100)),
                ('repeat_subtitle_template', models.CharField(blank=True, help_text='Subtitle template for repeated slides. {{ item.X }} available.', max_length=300)),
                ('max_rows', models.PositiveIntegerField(default=18, help_text='Max data rows per slide (tables split across slides)')),
                ('style_overrides', models.JSONField(blank=True, default=dict, help_text='Per-slide style overrides (row colors, etc.)')),
                ('speaker_notes_template', models.TextField(blank=True, help_text='Speaker notes template with {{ variable }} support')),
                ('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='template_slides', to='presentations.reporttemplate')),
            ],
            options={
                'ordering': ['order'],
            },
        ),
        migrations.CreateModel(
            name='Slide',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('layout', models.CharField(choices=[('cover', 'Cover'), ('section_divider', 'Section Divider'), ('kpi_dashboard', 'KPI Dashboard'), ('full_chart', 'Full Chart'), ('chart_metrics', 'Chart + Metrics'), ('data_table', 'Data Table'), ('two_column', 'Two Column'), ('quote', 'Quote / Callout'), ('timeline', 'Timeline'), ('comparison', 'Comparison'), ('team_grid', 'Team / Department Grid'), ('closing', 'Closing')], default='cover', max_length=30)),
                ('order', models.PositiveIntegerField(default=0)),
                ('title', models.CharField(blank=True, max_length=300)),
                ('subtitle', models.CharField(blank=True, max_length=500)),
                ('content', models.JSONField(blank=True, default=dict, help_text='Layout-specific content. Structure varies by slide type: kpi_dashboard={metrics:[...]}, full_chart={chart_config:{...}}, data_table={headers:[...], rows:[...]}, etc.')),
                ('background_color', models.CharField(blank=True, max_length=20)),
                ('speaker_notes', models.TextField(blank=True)),
                ('presentation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='slides', to='presentations.presentation')),
            ],
            options={
                'ordering': ['order'],
            },
        ),
        migrations.AddIndex(
            model_name='presentation',
            index=models.Index(fields=['status', '-created_at'], name='presentatio_status_796dc2_idx'),
        ),
        migrations.AddIndex(
            model_name='presentation',
            index=models.Index(fields=['hospital', '-created_at'], name='presentatio_hospita_440c35_idx'),
        ),
        migrations.AddIndex(
            model_name='presentation',
            index=models.Index(fields=['created_by', '-created_at'], name='presentatio_created_8f92d8_idx'),
        ),
        migrations.AddIndex(
            model_name='reporttemplate',
            index=models.Index(fields=['active', '-created_at'], name='presentatio_active_9f6871_idx'),
        ),
        migrations.AddIndex(
            model_name='reporttemplate',
            index=models.Index(fields=['data_source'], name='presentatio_data_so_3f9155_idx'),
        ),
        migrations.AddIndex(
            model_name='reporttemplateslide',
            index=models.Index(fields=['template', 'order'], name='presentatio_templat_377148_idx'),
        ),
        migrations.AddIndex(
            model_name='slide',
            index=models.Index(fields=['presentation', 'order'], name='presentatio_present_0069fe_idx'),
        ),
    ]
