# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-04-01 12:22
from __future__ import unicode_literals

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='Name')),
                ('access', models.CharField(choices=[('PUBLIC', 'Public'), ('PRIVATE', 'Private')], max_length=7, verbose_name='Access')),
                ('created', models.DateField(default=datetime.date.today, editable=False, verbose_name='Date')),
            ],
            options={
                'verbose_name': 'Group',
                'verbose_name_plural': 'Groups',
            },
        ),
        migrations.CreateModel(
            name='GroupMembership',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('permit', models.CharField(choices=[('ADMIN', 'Administrator'), ('PART', 'Participant')], max_length=5, verbose_name='Permit')),
                ('date_joined', models.DateField(default=datetime.date.today, editable=False, verbose_name='Date')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='group.Group')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Membership',
                'verbose_name_plural': 'Memberships',
            },
        ),
        migrations.CreateModel(
            name='GroupMembershipRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message', models.TextField(blank=True, default='I would like to join the group.', error_messages={'invalid': 'Insert text up to 150 characters.'}, help_text='Write custom message to group administrator.', max_length=150, verbose_name='Message')),
                ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False, verbose_name='Created')),
                ('rejected', models.DateTimeField(blank=True, null=True, verbose_name='Rejectd')),
                ('viewed', models.DateTimeField(blank=True, null=True, verbose_name='Viewed')),
                ('from_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='from_user', to=settings.AUTH_USER_MODEL)),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='group.Group')),
                ('to_administrator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_administrator', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Membership Request',
                'verbose_name_plural': 'Membership Requests',
            },
        ),
        migrations.AddField(
            model_name='group',
            name='members',
            field=models.ManyToManyField(through='group.GroupMembership', to=settings.AUTH_USER_MODEL),
        ),
    ]
