# Generated by Django 3.1.6 on 2021-05-29 20:20

import django.contrib.auth.models
import django.contrib.auth.validators
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, 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=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')),
                ('phone_number', models.CharField(blank=True, max_length=16, null=True, verbose_name='Номер телефона')),
                (
                    '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': 'Пользователь', 'verbose_name_plural': 'Пользователи',},
            managers=[('objects', django.contrib.auth.models.UserManager()),],
        ),
        migrations.CreateModel(
            name='Products',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=512)),
                ('img_url', models.URLField(blank=True, null=True)),
            ],
            options={'verbose_name': 'Препарат', 'verbose_name_plural': 'Products',},
        ),
        migrations.CreateModel(
            name='Property',
            fields=[
                ('id', models.IntegerField(primary_key=True, serialize=False)),
                ('code', models.CharField(max_length=512)),
                ('name', models.CharField(max_length=512)),
            ],
            options={'verbose_name': 'Параметр', 'verbose_name_plural': 'Property',},
        ),
        migrations.CreateModel(
            name='PropertyValues',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('iblock_element_id', models.IntegerField(unique=True)),
                ('property_276', models.CharField(blank=True, max_length=512, null=True)),
                ('property_429', models.CharField(blank=True, max_length=512, null=True)),
                ('property_326', models.CharField(blank=True, max_length=512, null=True)),
                ('property_574', models.CharField(blank=True, max_length=512, null=True)),
                ('property_265', models.CharField(blank=True, max_length=512, null=True)),
                ('property_284', models.CharField(blank=True, max_length=512, null=True)),
                ('property_541', models.CharField(blank=True, max_length=512, null=True)),
                ('property_542', models.CharField(blank=True, max_length=512, null=True)),
                ('property_343', models.CharField(blank=True, max_length=512, null=True)),
                ('property_428', models.CharField(blank=True, max_length=512, null=True)),
                ('property_274', models.CharField(blank=True, max_length=512, null=True)),
                ('property_263', models.FloatField(blank=True, null=True)),
                ('property_264', models.CharField(blank=True, max_length=512, null=True)),
                ('property_594', models.CharField(blank=True, max_length=512, null=True)),
                ('property_344', models.CharField(blank=True, max_length=512, null=True)),
                ('property_483', models.FloatField(blank=True, max_length=512, null=True)),
                ('property_536', models.CharField(blank=True, max_length=512, null=True)),
                ('property_540', models.CharField(blank=True, max_length=512, null=True)),
                ('property_356', models.CharField(blank=True, max_length=512, null=True)),
                ('property_567', models.CharField(blank=True, max_length=512, null=True)),
                ('property_332', models.CharField(blank=True, max_length=512, null=True)),
                ('property_283', models.CharField(blank=True, max_length=512, null=True)),
            ],
            options={'verbose_name': 'Значения параметра', 'verbose_name_plural': 'PropertyValues',},
        ),
        migrations.CreateModel(
            name='TreatmentCourse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('schedule_info', models.JSONField(default=dict, verbose_name='График приема лекарств')),
                (
                    'quantity',
                    models.DecimalField(decimal_places=3, max_digits=9, verbose_name='Количество единиц для приема'),
                ),
                (
                    'quantity_exists',
                    models.DecimalField(decimal_places=3, max_digits=9, verbose_name='Количество единиц в наличии'),
                ),
                (
                    'number_of_events',
                    models.IntegerField(blank=True, null=True, verbose_name='Количество событий приема'),
                ),
                ('is_active', models.BooleanField(default=True, verbose_name='Активный курс?')),
                ('is_enabled_for_generation', models.BooleanField(default=True, verbose_name='Генерировать события?')),
                (
                    'drug',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='treatment_course',
                        to='eaptekahack.products',
                        verbose_name='Препарат',
                    ),
                ),
                (
                    'user',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='treatment_course',
                        to=settings.AUTH_USER_MODEL,
                        verbose_name='Юзер',
                    ),
                ),
            ],
            options={'verbose_name': 'Курс приема', 'verbose_name_plural': 'Курс приема',},
        ),
        migrations.CreateModel(
            name='PropertyMultipleValues',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('iblock_element_id', models.IntegerField()),
                ('iblock_property_id', models.CharField(max_length=512)),
                ('value', models.CharField(blank=True, max_length=512, null=True)),
                ('value_enum', models.CharField(blank=True, max_length=512, null=True)),
                ('value_num', models.FloatField(blank=True, null=True)),
                ('description', models.CharField(blank=True, max_length=512, null=True)),
            ],
            options={
                'verbose_name': 'Параметр с несколькими значениями',
                'verbose_name_plural': 'PropertyMultipleValues',
                'unique_together': {('iblock_element_id', 'iblock_property_id', 'value')},
            },
        ),
        migrations.CreateModel(
            name='ProductMNN',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mnn_id', models.CharField(max_length=512)),
                ('product_id', models.IntegerField(blank=True, null=True)),
                ('mnn_name', models.CharField(blank=True, max_length=512, null=True, verbose_name='Наименование')),
                ('mnn_code', models.CharField(blank=True, max_length=512, null=True, verbose_name='Код')),
            ],
            options={
                'verbose_name': 'Международное непатентованное наименование',
                'verbose_name_plural': 'ProductMNN',
                'unique_together': {('mnn_id', 'product_id')},
            },
        ),
        migrations.CreateModel(
            name='MedicationAvailable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                (
                    'number_of_pills',
                    models.IntegerField(blank=True, null=True, verbose_name='Количество оставшихся таблеток на руках'),
                ),
                (
                    'course',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='medication_available',
                        to='eaptekahack.treatmentcourse',
                        verbose_name='Курс',
                    ),
                ),
            ],
            options={'verbose_name': 'Остаток лекарства', 'verbose_name_plural': 'Остаток лекарства',},
        ),
        migrations.CreateModel(
            name='EventForReminder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('planned_datetime', models.DateTimeField(verbose_name='Дата и время события')),
                (
                    'event_code',
                    models.CharField(
                        choices=[
                            ('taking_medical_drugs', 'Прием препарата'),
                            ('expiration_date', 'Окончание срока годности'),
                            ('drug_is_running_out', 'Окончание запаса лекарств'),
                            ('make_order', 'Сделать до-заказ'),
                        ],
                        db_index=True,
                        max_length=50,
                        verbose_name='Инициализирующее событие',
                    ),
                ),
                ('is_success', models.BooleanField(default=False, verbose_name='Событие успешно?')),
                ('comment', models.TextField(blank=True, null=True, verbose_name='Комментарий')),
                (
                    'course',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='reminder',
                        to='eaptekahack.treatmentcourse',
                        verbose_name='Курс',
                    ),
                ),
            ],
            options={'verbose_name': 'Событие', 'verbose_name_plural': 'События',},
        ),
    ]
