# Generated by Django 5.1.3 on 2025-11-20 12:01

import django.db.models.deletion
import django_modals.model_fields.colour
import time_stamped_model.models
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('advanced_report_builder', '0018_reportquery_target_target_period_type'),
    ]

    operations = [
        migrations.CreateModel(
            name='MultiCellStyle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', time_stamped_model.models.CreationDateTimeField(auto_now_add=True)),
                ('modified', time_stamped_model.models.ModificationDateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=200)),
                ('align_type', models.IntegerField(choices=[(0, 'Left'), (1, 'Centre'), (2, 'Right')], default=0)),
                ('bold', models.BooleanField(default=False)),
                ('italic', models.BooleanField(default=False)),
                ('font_size', models.PositiveSmallIntegerField()),
                ('font_colour', django_modals.model_fields.colour.ColourField(blank=True, max_length=10, null=True)),
                ('background_colour', django_modals.model_fields.colour.ColourField(blank=True, max_length=10, null=True)),
            ],
            options={
                'get_latest_by': 'created',
                'abstract': False,
            },
        ),
        migrations.AlterField(
            model_name='singlevaluereport',
            name='single_value_type',
            field=models.PositiveSmallIntegerField(choices=[(1, 'Count'), (2, 'Sum'), (3, 'Count & Sum'), (4, 'Percent'), (5, 'Percent from Count'), (6, 'Average Sum from Count'), (7, 'Average Sum over Time'), (8, 'Average Sum over Time (Excluding Weekends)')], default=1),
        ),
        migrations.CreateModel(
            name='MultiValueReport',
            fields=[
                ('report_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='advanced_report_builder.report')),
                ('rows', models.PositiveSmallIntegerField()),
                ('columns', models.PositiveSmallIntegerField()),
                ('default_multi_cell_style', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='advanced_report_builder.multicellstyle')),
            ],
            options={
                'get_latest_by': 'created',
                'abstract': False,
            },
            bases=('advanced_report_builder.report',),
        ),
        migrations.AddField(
            model_name='multicellstyle',
            name='multi_value_report',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='advanced_report_builder.multivaluereport'),
        ),
        migrations.CreateModel(
            name='MultiValueReportColumn',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', time_stamped_model.models.CreationDateTimeField(auto_now_add=True)),
                ('modified', time_stamped_model.models.ModificationDateTimeField(auto_now=True)),
                ('column', models.PositiveSmallIntegerField()),
                ('width_type', models.PositiveSmallIntegerField(choices=[(0, '%'), (1, 'Pixels')], default=0)),
                ('width', models.PositiveSmallIntegerField()),
                ('multi_value_report', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='advanced_report_builder.multivaluereport')),
            ],
            options={
                'get_latest_by': 'created',
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MultiValueReportCell',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', time_stamped_model.models.CreationDateTimeField(auto_now_add=True)),
                ('modified', time_stamped_model.models.ModificationDateTimeField(auto_now=True)),
                ('row', models.PositiveSmallIntegerField()),
                ('column', models.PositiveSmallIntegerField()),
                ('col_span', models.PositiveSmallIntegerField(default=1)),
                ('row_span', models.PositiveSmallIntegerField(default=1)),
                ('multi_value_type', models.IntegerField(choices=[(0, 'Static Text'), (1, 'Count'), (2, 'Sum'), (4, 'Percent'), (5, 'Percent from Count'), (6, 'Average Sum from Count'), (7, 'Average Sum over Time'), (8, 'Average Sum over Time (Excluding Weekends)'), (9, 'Equation')], default=0)),
                ('text', models.TextField(blank=True, null=True)),
                ('field', models.CharField(blank=True, max_length=200, null=True)),
                ('numerator', models.CharField(blank=True, max_length=200, null=True)),
                ('prefix', models.CharField(blank=True, max_length=64, null=True)),
                ('decimal_places', models.IntegerField(default=0)),
                ('show_breakdown', models.BooleanField(default=False)),
                ('breakdown_fields', models.JSONField(blank=True, null=True)),
                ('average_scale', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'Year'), (2, 'Quarter'), (3, 'Month'), (4, 'Week'), (5, 'Day')], null=True)),
                ('average_start_period', models.PositiveSmallIntegerField(blank=True, null=True)),
                ('average_end_period', models.PositiveSmallIntegerField(blank=True, null=True)),
                ('label', models.CharField(blank=True, max_length=256, null=True)),
                ('query_data', models.JSONField(blank=True, null=True)),
                ('extra_query_data', models.JSONField(blank=True, null=True)),
                ('multi_cell_style', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='advanced_report_builder.multicellstyle')),
                ('multi_value_report', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='advanced_report_builder.multivaluereport')),
                ('report_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='advanced_report_builder.reporttype')),
            ],
            options={
                'constraints': [models.UniqueConstraint(fields=('multi_value_report', 'row', 'column'), name='multi_value_report_cell_unique')],
            },
        ),
    ]
