# Generated by Django 4.2.2 on 2023-07-17 14:12

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='BBox',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('l', models.IntegerField()),
                ('b', models.IntegerField()),
                ('r', models.IntegerField()),
                ('t', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('md5', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Language',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True)),
                ('iso1', models.CharField(max_length=8, unique=True)),
                ('iso2b', models.CharField(max_length=8, unique=True)),
                ('iso2t', models.CharField(max_length=8, unique=True)),
                ('iso3', models.CharField(max_length=32, unique=True)),
                ('easyocr', models.CharField(max_length=32, null=True)),
                ('tesseract', models.CharField(max_length=32, null=True)),
                ('facebookM2M', models.CharField(max_length=32, null=True)),
                ('break_chars', models.CharField(max_length=512, null=True)),
                ('ignore_chars', models.CharField(max_length=512, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='OCRBoxModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('language_format', models.CharField(max_length=32, null=True)),
                ('languages', models.ManyToManyField(related_name='box_models', to='ocr_translate.language')),
            ],
        ),
        migrations.CreateModel(
            name='OCRModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('language_format', models.CharField(max_length=32, null=True)),
                ('languages', models.ManyToManyField(related_name='ocr_models', to='ocr_translate.language')),
            ],
        ),
        migrations.CreateModel(
            name='OptionDict',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('options', models.JSONField(unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Text',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='TSLModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('language_format', models.CharField(max_length=32, null=True)),
                ('dst_languages', models.ManyToManyField(related_name='tsl_models_dst', to='ocr_translate.language')),
                ('src_languages', models.ManyToManyField(related_name='tsl_models_src', to='ocr_translate.language')),
            ],
        ),
        migrations.CreateModel(
            name='TranslationRun',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lang_dst', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trans_dst', to='ocr_translate.language')),
                ('lang_src', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trans_src', to='ocr_translate.language')),
                ('model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tsl_runs', to='ocr_translate.tslmodel')),
                ('options', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trans_options', to='ocr_translate.optiondict')),
                ('result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='from_trans', to='ocr_translate.text')),
                ('text', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_trans', to='ocr_translate.text')),
            ],
        ),
        migrations.CreateModel(
            name='OCRRun',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bbox', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_ocr', to='ocr_translate.bbox')),
                ('lang_src', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ocr_src', to='ocr_translate.language')),
                ('model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ocr_runs', to='ocr_translate.ocrmodel')),
                ('options', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ocr_options', to='ocr_translate.optiondict')),
                ('result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='from_ocr', to='ocr_translate.text')),
            ],
        ),
        migrations.CreateModel(
            name='OCRBoxRun',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_box', to='ocr_translate.image')),
                ('lang_src', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='box_src', to='ocr_translate.language')),
                ('model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='box_runs', to='ocr_translate.ocrboxmodel')),
                ('options', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ocr_box_options', to='ocr_translate.optiondict')),
            ],
        ),
        migrations.AddField(
            model_name='bbox',
            name='from_ocr',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='result', to='ocr_translate.ocrboxrun'),
        ),
        migrations.AddField(
            model_name='bbox',
            name='image',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bboxes', to='ocr_translate.image'),
        ),
    ]
