# Generated by Django 4.0.2 on 2022-02-22 01:23

from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import rest.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=128, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'db_table': 'auth_user',
            },
            bases=(models.Model, rest.models.RestModel),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.CharField(blank=True, db_index=True, default=None, max_length=64, null=True)),
                ('name', models.CharField(db_index=True, max_length=200)),
                ('short_name', models.CharField(blank=True, default=None, max_length=60, null=True)),
                ('kind', models.CharField(db_index=True, default='org', max_length=80)),
                ('created', models.DateTimeField(auto_now=True)),
                ('is_active', models.BooleanField(blank=True, default=True)),
                ('children', models.ManyToManyField(related_name='parents', to='account.Group')),
                ('parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='groups', to='account.group')),
            ],
            bases=(models.Model, rest.models.RestModel, rest.models.MetaDataModel),
        ),
        migrations.CreateModel(
            name='Membership',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('role', models.CharField(blank=True, default='guest', max_length=64, null=True)),
                ('state', models.IntegerField(default=0)),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='memberships', to='account.group')),
            ],
            bases=(models.Model, rest.models.RestModel, rest.models.MetaDataModel),
        ),
        migrations.CreateModel(
            name='NotificationRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('method', models.CharField(db_index=True, default='email', max_length=128)),
                ('from_addr', models.CharField(max_length=255)),
                ('subject', models.CharField(max_length=255)),
                ('body', models.TextField()),
                ('reason', models.TextField()),
                ('state', models.IntegerField(choices=[(0, 'new'), (-5, 'queued'), (1, 'sent'), (-10, 'failed')], db_index=True, default=0)),
                ('attempts', models.IntegerField(default=0)),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='Member',
            fields=[
                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
                ('uuid', models.CharField(blank=True, db_index=True, default='', max_length=64)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('display_name', models.CharField(blank=True, default=None, max_length=64, null=True)),
                ('auth_code', models.CharField(blank=True, db_index=True, default=None, max_length=64, null=True)),
                ('password_changed', models.DateTimeField(blank=True, default=None, null=True)),
                ('last_activity', models.DateTimeField(blank=True, default=None, null=True)),
                ('requires_topt', models.BooleanField(blank=True, default=False, null=True)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            bases=('account.user', rest.models.RestModel, rest.models.MetaDataModel),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='NotificationAttachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('name', models.CharField(max_length=255)),
                ('mimetype', models.CharField(max_length=255)),
                ('data', models.TextField()),
                ('notification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='account.notificationrecord')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='MembershipMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('key', models.CharField(db_index=True, max_length=80)),
                ('value_format', models.CharField(max_length=16)),
                ('value', models.TextField()),
                ('int_value', models.IntegerField(blank=True, default=None, null=True)),
                ('float_value', models.IntegerField(blank=True, default=None, null=True)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='properties', to='account.membership')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='GroupMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('key', models.CharField(db_index=True, max_length=80)),
                ('value_format', models.CharField(max_length=16)),
                ('value', models.TextField()),
                ('int_value', models.IntegerField(blank=True, default=None, null=True)),
                ('float_value', models.IntegerField(blank=True, default=None, null=True)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='properties', to='account.group')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PasswordHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('password', models.CharField(max_length=255)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='password_history', to='account.member')),
            ],
        ),
        migrations.CreateModel(
            name='NotificationMemberRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('to_addr', models.CharField(db_index=True, max_length=255)),
                ('notification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to', to='account.notificationrecord')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to='account.member')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.AddField(
            model_name='membership',
            name='member',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='memberships', to='account.member'),
        ),
        migrations.CreateModel(
            name='MemberMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('key', models.CharField(db_index=True, max_length=80)),
                ('value_format', models.CharField(max_length=16)),
                ('value', models.TextField()),
                ('int_value', models.IntegerField(blank=True, default=None, null=True)),
                ('float_value', models.IntegerField(blank=True, default=None, null=True)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='properties', to='account.member')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MemberFeed',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('component', models.SlugField(blank=True, default=None, max_length=124, null=True)),
                ('component_id', models.IntegerField(blank=True, db_index=True, default=None, null=True)),
                ('kind', models.SlugField(max_length=32)),
                ('note', models.TextField(blank=True, default=None, null=True)),
                ('group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='account.group')),
                ('member', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='feed', to='account.member')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='GroupFeed',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('component', models.SlugField(blank=True, default=None, max_length=124, null=True)),
                ('component_id', models.IntegerField(blank=True, db_index=True, default=None, null=True)),
                ('kind', models.SlugField(max_length=32)),
                ('note', models.TextField(blank=True, default=None, null=True)),
                ('group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='feed', to='account.group')),
                ('member', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='account.member')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BounceHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('address', models.CharField(db_index=True, max_length=255)),
                ('kind', models.CharField(db_index=True, max_length=32)),
                ('reason', models.TextField(blank=True, default=None, null=True)),
                ('reporter', models.CharField(blank=True, default=None, max_length=255, null=True)),
                ('code', models.CharField(blank=True, default=None, max_length=32, null=True)),
                ('source', models.CharField(blank=True, default=None, max_length=255, null=True)),
                ('source_ip', models.CharField(blank=True, default=None, max_length=64, null=True)),
                ('user', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='bounces', to='account.member')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='AuthToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('token', models.TextField(db_index=True, unique=True)),
                ('role', models.CharField(blank=True, default=None, max_length=128, null=True)),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='auth_tokens', to='account.member')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
    ]
