# Generated by Django 3.2.24 on 2025-06-28 14:09

import uuid

import django.db.models.deletion
import django.utils.timezone
from django.db import (
    migrations,
    models,
)

import educommon.django.db.mixins

import edu_rdm_integration.core.utils


class Migration(migrations.Migration):
    dependencies = [
        ('edu_rdm_integration_models', '0001_initial'),
        ('async_task', '0003_alter_runningtask_options'),
        ('edu_rdm_integration_collect_data_stage', '0001_initial'),
        ('rdm_collect_and_export_data', '0003_auto_20250704_0725'),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(
            state_operations=[
                migrations.CreateModel(
                    name='EduRdmCollectDataCommandProgress',
                    fields=[
                        (
                            'id',
                            models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
                        ),
                        (
                            'created',
                            models.DateTimeField(default=django.utils.timezone.now, verbose_name='Дата создания'),
                        ),
                        (
                            'logs_period_started_at',
                            models.DateTimeField(verbose_name='Левая граница периода обрабатываемых логов'),
                        ),
                        (
                            'logs_period_ended_at',
                            models.DateTimeField(verbose_name='Правая граница периода обрабатываемых логов'),
                        ),
                        ('generation_id', models.UUIDField(default=uuid.uuid4, verbose_name='Идентификатор генерации')),
                        (
                            'institute_ids',
                            models.JSONField(blank=True, default=list, null=True, verbose_name='id учебного заведения'),
                        ),
                        (
                            'logs_link',
                            models.FileField(
                                max_length=255,
                                upload_to=edu_rdm_integration.core.utils.get_data_command_progress_attachment_path,
                                verbose_name='Ссылка на файл логов',
                            ),
                        ),
                        (
                            'type',
                            models.PositiveSmallIntegerField(
                                choices=[(1, 'Автоматический'), (2, 'Ручной')], verbose_name='Тип команды'
                            ),
                        ),
                        (
                            'model',
                            models.ForeignKey(
                                on_delete=django.db.models.deletion.PROTECT,
                                to='edu_rdm_integration_models.regionaldatamartmodelenum',
                                verbose_name='Модель РВД',
                            ),
                        ),
                        (
                            'stage',
                            models.ForeignKey(
                                blank=True,
                                null=True,
                                on_delete=django.db.models.deletion.SET_NULL,
                                to='edu_rdm_integration_collect_data_stage.collectingexporteddatastage',
                                verbose_name='Этап формирования данных для выгрузки',
                            ),
                        ),
                        (
                            'task',
                            models.ForeignKey(
                                blank=True,
                                null=True,
                                on_delete=django.db.models.deletion.SET_NULL,
                                to='async_task.runningtask',
                                verbose_name='Асинхронная задача',
                            ),
                        ),
                    ],
                    options={
                        'verbose_name': 'Задача по сбору данных',
                        'verbose_name_plural': 'Задачи по сбору данных',
                        'db_table': 'edu_rdm_collecting_data_command_progress',
                        'abstract': False,
                    },
                    bases=(educommon.django.db.mixins.ReprStrPreModelMixin, models.Model),
                ),
            ],
            database_operations=[],
        ),
    ]
