# Generated by Django 2.2 on 2019-07-25 01:54

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='AccessRule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('title', models.CharField(max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='File',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('file', models.FileField(blank=True, upload_to='')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('file', models.ImageField(blank=True, upload_to='')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='KavenegarSMS',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('receptor', models.CharField(max_length=255)),
                ('message', models.TextField()),
                ('template_title', models.CharField(blank=True, max_length=255, null=True)),
                ('http_status_code', models.CharField(blank=True, max_length=255)),
                ('message_id', models.CharField(blank=True, max_length=255)),
                ('status', models.IntegerField(blank=True, default=-1)),
                ('sender', models.CharField(blank=True, max_length=255)),
                ('date', models.DateTimeField(blank=True, null=True)),
                ('cost', models.IntegerField(blank=True, default=0)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('phone', models.CharField(max_length=255, unique=True)),
                ('first_name', models.CharField(blank=True, max_length=255)),
                ('last_name', models.CharField(blank=True, max_length=255)),
                ('is_active', models.BooleanField(default=False)),
                ('have_profile', models.BooleanField(default=False)),
                ('date_updated', models.DateTimeField(blank=True, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('title', models.CharField(max_length=255)),
                ('token_valid_seconds', models.IntegerField(default=0)),
                ('is_base_group', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserUserGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('is_logged_in', models.BooleanField(default=False)),
                ('date_last_login', models.DateTimeField(blank=True, null=True)),
                ('date_last_used', models.DateTimeField(blank=True, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_user_groups', to='avishan.User')),
                ('user_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_user_groups', to='avishan.UserGroup')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserAccessRule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('is_allowed', models.BooleanField(default=True)),
                ('access_rule', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_access_rules', to='avishan.AccessRule')),
                ('granted_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='granted_user_access_rules', to='avishan.User')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_access_rules', to='avishan.User')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ActivationCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('code', models.CharField(max_length=255)),
                ('kavenegar_sms', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='avishan.KavenegarSMS')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='accessrule',
            name='user_groups',
            field=models.ManyToManyField(related_name='access_rules', to='avishan.UserGroup'),
        ),
    ]
