# Generated by Django 2.2.8 on 2019-12-24 15:52

import c3nav.mapdata.fields
import c3nav.mapdata.models.report
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('mapdata', '0077_obstacle_altitude'),
    ]

    operations = [
        migrations.CreateModel(
            name='Report',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('category', models.CharField(choices=[('location-issue', 'location issue'), ('missing-location', 'missing location'), ('route-issue', 'route issue')], db_index=True, max_length=20, verbose_name='category')),
                ('open', models.BooleanField(default=True, verbose_name='open')),
                ('last_update', models.DateTimeField(auto_now=True, verbose_name='last_update')),
                ('title', models.CharField(default='', help_text='a short title for your report', max_length=100, verbose_name='title')),
                ('description', models.TextField(default='', help_text="tell us precisely what's wrong", max_length=1000, verbose_name='description')),
                ('coordinates_id', models.CharField(max_length=48, null=True, verbose_name='coordinates')),
                ('origin_id', models.CharField(max_length=48, null=True, verbose_name='origin')),
                ('destination_id', models.CharField(max_length=48, null=True, verbose_name='destination')),
                ('route_options', models.CharField(max_length=128, null=True, verbose_name='route options')),
                ('created_title', c3nav.mapdata.fields.I18nField(fallback_any=True, help_text='you have to supply a title in at least one language', plural_name='titles', verbose_name='new location title')),
                ('secret', models.CharField(default=c3nav.mapdata.models.report.get_report_secret, max_length=32, verbose_name='secret')),
                ('assigned_to', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='assigned_reports', to=settings.AUTH_USER_MODEL, verbose_name='assigned to')),
                ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='report', to=settings.AUTH_USER_MODEL, verbose_name='author')),
            ],
            options={
                'verbose_name': 'Report',
                'verbose_name_plural': 'Reports',
                'default_related_name': 'report',
            },
        ),
        migrations.AlterModelOptions(
            name='lineobstacle',
            options={'default_related_name': 'lineobstacles', 'ordering': ('altitude', 'height'), 'verbose_name': 'Line Obstacle', 'verbose_name_plural': 'Line Obstacles'},
        ),
        migrations.AlterModelOptions(
            name='obstacle',
            options={'default_related_name': 'obstacles', 'ordering': ('altitude', 'height'), 'verbose_name': 'Obstacle', 'verbose_name_plural': 'Obstacles'},
        ),
        migrations.AddField(
            model_name='locationgroup',
            name='can_report_missing',
            field=models.BooleanField(default=False, help_text='can be used when reporting a missing location', verbose_name='for missing locations'),
        ),
        migrations.CreateModel(
            name='ReportUpdate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='datetime')),
                ('open', models.NullBooleanField(verbose_name='open')),
                ('comment', models.TextField(verbose_name='comment')),
                ('public', models.BooleanField(verbose_name='public')),
                ('assigned_to', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='report_update_assigns', to=settings.AUTH_USER_MODEL, verbose_name='assigned to')),
                ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='reportupdate', to=settings.AUTH_USER_MODEL, verbose_name='author')),
                ('report', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reportupdate', to='mapdata.Report')),
            ],
            options={
                'verbose_name': 'Report update',
                'verbose_name_plural': 'Report updates',
                'default_related_name': 'reportupdate',
            },
        ),
        migrations.AddField(
            model_name='report',
            name='created_groups',
            field=models.ManyToManyField(blank=True, help_text='select all groups that apply, if any', limit_choices_to={'can_report_missing': True}, related_name='report', to='mapdata.LocationGroup', verbose_name='location groups'),
        ),
        migrations.AddField(
            model_name='report',
            name='location',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reports', to='mapdata.LocationSlug', verbose_name='location'),
        ),
    ]
