# Generated by Django 4.1.4 on 2023-06-12 10:07

import anatomy.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AnatomyQuestion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('authors_only', models.BooleanField(default=False, help_text='If true only question authors will be able to view.')),
                ('created_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('open_access', models.BooleanField(default=True, help_text='If a question should be freely available to browse')),
                ('feedback', models.TextField(blank=True, help_text='Question Feedback', null=True)),
                ('image', models.ImageField(help_text="The image to use for the question. Ideally use use unmarked images and annotate (arrow) them on the test system. If you wish to reuse an image that is already uploaded 'clone' the question that contains it.", upload_to=anatomy.models.image_directory_path)),
                ('image_annotations', models.TextField(blank=True, help_text='Stores a JSON representation of annotations to be applied by cornerstonetools')),
                ('description', models.CharField(help_text="Short description of the image e.g. 'Sagittal CT Chest, Abdomen & Pelvis', will be displayed as the title.", max_length=400)),
            ],
            options={
                'permissions': (),
            },
        ),
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('answer', models.TextField(max_length=500)),
                ('answer_compare', models.TextField(max_length=500)),
                ('status', models.CharField(choices=[('', 'Unmarked'), ('0', 'Incorrect'), ('1', 'Half mark'), ('2', 'Correct')], default='', max_length=1)),
                ('proposed', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='BodyPart',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bodypart', models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='Exam',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the exam', max_length=200)),
                ('active', models.BooleanField(default=False, help_text='If an exam should be available to take')),
                ('exam_mode', models.BooleanField(default=False, help_text='If an exam should be taken in exam mode (users results will be submited to the server for marking)')),
                ('include_history', models.BooleanField(default=False, help_text='If an exam should include history when taking')),
                ('publish_results', models.BooleanField(default=False, help_text='If an exams results should be available')),
                ('recreate_json', models.BooleanField(default=False, help_text='If the json cache needs updating')),
                ('json_creation_time', models.DateTimeField(blank=True, default=None, null=True)),
                ('exam_json_id', models.IntegerField(default=1, help_text='auto incrementing field when json recreated')),
                ('archive', models.BooleanField(default=False, help_text='Archived exams will remain on the test system but will not be displayed by default')),
                ('open_access', models.BooleanField(default=False, help_text='If the exam is freely accessible (to view and edit on the test system)')),
                ('authors_only', models.BooleanField(default=False, help_text='If true only exam authors will be able to view.')),
                ('stats_mean', models.FloatField(default=0)),
                ('stats_mode', models.CharField(default=0, max_length=25)),
                ('stats_median', models.FloatField(default=0)),
                ('stats_candidates', models.FloatField(default=0)),
                ('stats_min', models.FloatField(default=0)),
                ('stats_max', models.FloatField(default=0)),
                ('stats_max_possible', models.FloatField(default=0)),
                ('user_scores', models.JSONField(default=dict)),
                ('exam_results_emailed', models.DateTimeField(default=None, null=True)),
                ('time_limit', models.IntegerField(default=5400, help_text='Exam time limit (in seconds)')),
                ('author', models.ManyToManyField(blank=True, help_text='Author of exam', related_name='anatomy_exam_author', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Modality',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('modality', models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='QuestionType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=400)),
            ],
        ),
        migrations.CreateModel(
            name='Region',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('region', models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='Structure',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('structure', models.CharField(max_length=200, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='UserAnswer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cid', models.BigIntegerField(blank=True, help_text='Candidate ID (limitied by BigIntegerField size)', null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('answer', models.TextField(blank=True, max_length=500)),
                ('answer_compare', models.TextField(blank=True, max_length=500)),
                ('score', models.CharField(blank=True, choices=[('', 'Unmarked'), ('0', 'Incorrect'), ('1', 'Half mark'), ('2', 'Correct')], default='', max_length=1)),
                ('exam', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='anatomy.exam')),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='anatomy.anatomyquestion')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_anatomy_user_answers', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['cid'],
                'abstract': False,
            },
        ),
    ]
