# Generated by Django 5.2.16 on 2026-08-11 23:40

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Announcement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=180)),
                ('body', models.TextField()),
                ('audience', models.CharField(choices=[('ALL', 'Everyone (HQ)'), ('CAMPUS', 'Campus only')], default='ALL', max_length=10)),
                ('pinned', models.BooleanField(default=False)),
                ('published', models.BooleanField(default=True)),
                ('published_at', models.DateTimeField()),
                ('expires_at', models.DateTimeField(blank=True, null=True)),
                ('campus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.campus')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-pinned', '-published_at'],
            },
        ),
        migrations.CreateModel(
            name='Broadcast',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=150)),
                ('message', models.CharField(max_length=480)),
                ('audience', models.CharField(choices=[('ALL', 'All members'), ('CAMPUS', 'Campus members')], max_length=10)),
                ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('QUEUED', 'Queued'), ('SENT', 'Sent'), ('FAILED', 'Failed')], default='DRAFT', max_length=10)),
                ('recipient_count', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('sent_at', models.DateTimeField(blank=True, null=True)),
                ('error', models.TextField(blank=True)),
                ('campus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.campus')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ForumTopic',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=180)),
                ('body', models.TextField()),
                ('visibility', models.CharField(choices=[('GENERAL', 'General community'), ('CAMPUS', 'Campus community')], default='GENERAL', max_length=10)),
                ('pinned', models.BooleanField(default=False)),
                ('locked', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('campus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.campus')),
            ],
            options={
                'ordering': ['-pinned', '-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='ForumReply',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('body', models.TextField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('edited_at', models.DateTimeField(blank=True, null=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='replies', to='engagement.forumtopic')),
            ],
            options={
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='ServiceEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('event_type', models.CharField(choices=[('CHURCH', 'Church service'), ('EVANGELISM', 'Evangelism'), ('SOUL_WINNING', 'Soul winning'), ('FELLOWSHIP', 'Fellowship'), ('OTHER', 'Other activity')], max_length=20)),
                ('title', models.CharField(max_length=180)),
                ('starts_at', models.DateTimeField()),
                ('venue', models.CharField(max_length=180)),
                ('description', models.TextField(blank=True)),
                ('registration_open', models.BooleanField(default=True)),
                ('campus', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service_events', to='core.campus')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-starts_at'],
            },
        ),
        migrations.CreateModel(
            name='Sermon',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=180)),
                ('preacher', models.CharField(max_length=150)),
                ('preached_on', models.DateField()),
                ('scripture', models.CharField(blank=True, max_length=180)),
                ('description', models.TextField(blank=True)),
                ('media_url', models.URLField()),
                ('thumbnail_url', models.URLField(blank=True)),
                ('published', models.BooleanField(default=True)),
                ('campus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.campus')),
                ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sermons', to='engagement.serviceevent')),
            ],
            options={
                'ordering': ['-preached_on'],
            },
        ),
        migrations.CreateModel(
            name='GalleryItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=160)),
                ('caption', models.TextField(blank=True)),
                ('image_url', models.URLField()),
                ('published', models.BooleanField(default=True)),
                ('captured_at', models.DateTimeField()),
                ('campus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.campus')),
                ('uploaded_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
                ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='engagement.serviceevent')),
            ],
            options={
                'ordering': ['-captured_at'],
            },
        ),
        migrations.CreateModel(
            name='Attendance',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('registered_at', models.DateTimeField(auto_now_add=True)),
                ('checked_in', models.BooleanField(default=False)),
                ('checked_in_at', models.DateTimeField(blank=True, null=True)),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service_attendance', to=settings.AUTH_USER_MODEL)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='registrations', to='engagement.serviceevent')),
            ],
            options={
                'ordering': ['-registered_at'],
                'constraints': [models.UniqueConstraint(fields=('event', 'member'), name='unique_event_member_attendance')],
            },
        ),
    ]
