# Generated by Django 3.1 on 2022-07-12 03:00

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('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=150, 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')),
                ('id', models.BigIntegerField(primary_key=True, serialize=False)),
                ('seed_code', models.IntegerField(default=telegram_django_bot.models._seed_code)),
                ('telegram_username', models.CharField(blank=True, max_length=64, null=True)),
                ('timezone', models.DurationField(default=datetime.timedelta(seconds=10800))),
                ('message_write_code', models.CharField(choices=[('D', 'default'), ('TV', 'target value'), ('TN', 'target name'), ('PV', 'payment value'), ('RV', 'report value'), ('DN', 'WRITE_CODE_DAY_REPORT_NAME')], default='D', max_length=3)),
                ('message_write_code_dttm', models.DateTimeField(blank=True, null=True)),
                ('message_write_code_context', models.CharField(blank=True, default='', max_length=128)),
                ('tax', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
                ('activated', models.BooleanField(default=False)),
                ('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={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='BotMenuElem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('command', models.CharField(blank=True, help_text='Команда бота, по которой можно вызвать этот блок меню', max_length=32, null=True, unique=True)),
                ('empty_block', models.BooleanField(default=False, help_text='если забыли и нет события ловяшего коллбек, то это покажет')),
                ('is_visable', models.BooleanField(default=True, help_text='Отображать ли этот блок меню пользователям (можно скрыть и не удалять для удобства)')),
                ('callbacks_db', models.TextField(blank=True, help_text='список регулярных выражений (пока только явный список) для коллбеков, которые вызывают это блок меню', null=True)),
                ('forward_message_id', models.IntegerField(blank=True, null=True)),
                ('forward_chat_id', models.IntegerField(blank=True, null=True)),
                ('message', models.TextField(help_text='Текстовое сообщение')),
                ('buttons_db', models.TextField(blank=True, help_text='InlineKeyboardMarkup список кнопок, ({"text": , "url" or "callback_data"})', null=True)),
                ('media', models.FileField(blank=True, help_text='Файл приложение к сообщению', null=True, upload_to='')),
                ('telegram_file_code', models.CharField(blank=True, help_text='Код файла в телеграмме (удалить при замене файла)', max_length=512, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Trigger',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dttm_added', models.DateTimeField(default=django.utils.timezone.now)),
                ('dttm_deleted', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=512, unique=True)),
                ('condition_db', models.TextField(help_text="\n    {\n        seeds: [1, 2, 3, 4, 5],\n        'amount': [{\n            'gte': 5,\n            'type__contains': 'dd',  // type__in, type\n            'duration': '7d'\n        }]\n    }\n    ")),
                ('min_duration', models.DurationField(help_text='минимальный период, в который может быть 1 уведомление для пользователя данного типа')),
                ('priority', models.IntegerField(default=1, help_text='чем больше тем в первую очередь будут выполняться')),
                ('botmenuelem', models.ForeignKey(help_text='какое сообщение по тригеру показываем', on_delete=django.db.models.deletion.PROTECT, to='telegram_django_bot.botmenuelem')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserTrigger',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dttm_added', models.DateTimeField(default=django.utils.timezone.now)),
                ('dttm_deleted', models.DateTimeField(blank=True, null=True)),
                ('message_id', models.BigIntegerField(blank=True, null=True)),
                ('is_sent', models.BooleanField(default=False)),
                ('trigger', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='telegram_django_bot.trigger')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TeleDeepLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, default='', max_length=64)),
                ('price', models.FloatField(blank=True, null=True)),
                ('link', models.CharField(max_length=64, validators=[django.core.validators.RegexValidator('^[a-zA-Z0-9_-]+$', 'Телеграм принимает только буквы, цифры и знаки - _ ')])),
                ('users', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ActionLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dttm', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('type', models.CharField(max_length=32)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
