# Generated by Django 4.2.7 on 2023-11-21 07:28

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import huscy.project_ethics.models


class Migration(migrations.Migration):

    replaces = [('project_ethics', '0001_initial'), ('project_ethics', '0002_auto_20211101_0600'), ('project_ethics', '0003_alter_ethicfile_filehandle'), ('project_ethics', '0004_alter_ethicfile_filetype'), ('project_ethics', '0005_rename_ethicboard_ethicscommittee_and_more'), ('project_ethics', '0006_alter_ethic_options_and_more'), ('project_ethics', '0007_rename_ethic_ethics_alter_ethics_options_and_more'), ('project_ethics', '0008_alter_ethicfile_options_and_more'), ('project_ethics', '0009_rename_ethicfile_ethicsfile'), ('project_ethics', '0010_alter_ethicsfile_ethics')]

    initial = True

    dependencies = [
        ('projects', '0003_project_project_manager_and_more'),
        ('projects', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='EthicsCommittee',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True, verbose_name='Name')),
            ],
            options={
                'verbose_name': 'Ethics committee',
                'verbose_name_plural': 'Ethics committees',
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='Ethics',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(blank=True, default='', max_length=255, verbose_name='Code')),
                ('ethics_committee', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='project_ethics.ethicscommittee', verbose_name='Ethics committee')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ethics', to='projects.project', verbose_name='Project')),
            ],
            options={
                'verbose_name': 'Ethics',
                'verbose_name_plural': 'Ethics',
                'ordering': ('-project', 'ethics_committee__name'),
                'unique_together': {('project', 'ethics_committee')},
            },
        ),
        migrations.CreateModel(
            name='EthicsFile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('filetype', models.PositiveSmallIntegerField(choices=[(0, 'Proposal'), (1, 'Attachment'), (2, 'Vote'), (3, 'Cover letter')], verbose_name='File type')),
                ('filehandle', models.FileField(max_length=255, upload_to=huscy.project_ethics.models.EthicsFile.get_upload_path, validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['pdf'])], verbose_name='File handle')),
                ('filename', models.CharField(max_length=255, verbose_name='File name')),
                ('uploaded_at', models.DateTimeField(auto_now_add=True, verbose_name='Uploaded at')),
                ('uploaded_by', models.CharField(editable=False, max_length=126, verbose_name='Uploaded by')),
                ('ethics', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='ethics_files', to='project_ethics.ethics', verbose_name='Ethics')),
            ],
            options={
                'verbose_name': 'Ethic file',
                'verbose_name_plural': 'Ethic files',
                'ordering': ('-ethics__project', '-ethics', 'filename'),
            },
        ),
    ]
