# Generated by Django 4.0.1 on 2023-03-29 20:38

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import utils


class Migration(migrations.Migration):

    replaces = [('mailer', '0001_initial'), ('mailer', '0002_auto_20190615_1225'), ('mailer', '0003_emailaddress'), ('mailer', '0004_auto_20200924_1744'), ('mailer', '0005_auto_20200924_2139'), ('mailer', '0006_auto_20210924_1155')]

    dependencies = [
        ('members', '0006_auto_20190914_2341'),
        ('members', '0008_auto_20210924_1155'),
        ('members', '0001_initial'),
        ('members', '0007_auto_20200924_1512'),
        ('members', '0005_auto_20190615_1224'),
    ]

    operations = [
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('subject', models.CharField(max_length=50, verbose_name='subject')),
                ('content', models.TextField(verbose_name='content')),
                ('sent', models.BooleanField(default=False, verbose_name='sent')),
                ('to_groups', models.ManyToManyField(blank=True, to='members.Group', verbose_name='to group')),
                ('to_members', models.ManyToManyField(blank=True, to='members.Member', verbose_name='to member')),
                ('reply_to', models.ManyToManyField(blank=True, related_name='reply_to', to='members.Member', verbose_name='reply to participant')),
            ],
            options={
                'verbose_name_plural': 'messages',
                'permissions': (('submit_mails', 'Can submit mails'),),
                'verbose_name': 'message',
            },
        ),
        migrations.CreateModel(
            name='Attachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('f', utils.RestrictedFileField(blank=True, upload_to='attachments', verbose_name='file')),
                ('msg', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mailer.message')),
            ],
            options={
                'verbose_name_plural': 'attachments',
                'verbose_name': 'attachment',
            },
        ),
        migrations.CreateModel(
            name='EmailAddress',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z]*$', 'Only alphanumeric characters are allowed')], verbose_name='name')),
                ('to_members', models.ManyToManyField(blank=True, to='members.Member', verbose_name='Forward to participants')),
                ('to_groups', models.ManyToManyField(blank=True, to='members.Group', verbose_name='Forward to group')),
            ],
            options={
                'verbose_name_plural': 'email addresses',
                'verbose_name': 'email address',
            },
        ),
        migrations.AddField(
            model_name='message',
            name='reply_to_email_address',
            field=models.ManyToManyField(blank=True, related_name='reply_to_email_addr', to='mailer.EmailAddress', verbose_name='reply to custom email address'),
        ),
        migrations.AddField(
            model_name='message',
            name='to_freizeit',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='members.freizeit', verbose_name='to freizeit'),
        ),
        migrations.AddField(
            model_name='message',
            name='to_notelist',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='members.membernotelist', verbose_name='to notes list'),
        ),
    ]
