# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-14 13:19
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        ('mapdata', '0028_door_access_restriction'),
    ]

    operations = [
        migrations.CreateModel(
            name='GraphEdge',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('access_restriction', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='graphedges', to='mapdata.AccessRestriction', verbose_name='Access Restriction')),
            ],
            options={
                'verbose_name': 'Graph Edge',
                'verbose_name_plural': 'Graph Edges',
                'default_related_name': 'graphedges',
            },
        ),
        migrations.CreateModel(
            name='GraphNode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('geometry', c3nav.mapdata.fields.GeometryField(default=None, geomtype='point')),
                ('space_transfer', models.BooleanField(db_index=True, default=False, verbose_name='space transfer node')),
                ('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='graphnodes', to='mapdata.Space', verbose_name='space')),
            ],
            options={
                'verbose_name': 'Graph Node',
                'verbose_name_plural': 'Graph Nodes',
                'default_related_name': 'graphnodes',
            },
        ),
        migrations.CreateModel(
            name='WayType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('titles', c3nav.mapdata.fields.JSONField(default={})),
                ('color', models.CharField(max_length=32, verbose_name='edge color')),
            ],
            options={
                'verbose_name': 'Way Type',
                'verbose_name_plural': 'Way Types',
                'default_related_name': 'waytypes',
            },
        ),
        migrations.AddField(
            model_name='graphedge',
            name='from_node',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='edges_from_here', to='mapdata.GraphNode', verbose_name='from node'),
        ),
        migrations.AddField(
            model_name='graphedge',
            name='to_node',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='edges_to_here', to='mapdata.GraphNode', verbose_name='to node'),
        ),
        migrations.AddField(
            model_name='graphedge',
            name='waytype',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='graphedges', to='mapdata.WayType', verbose_name='Way Type'),
        ),
        migrations.AlterUniqueTogether(
            name='graphedge',
            unique_together=set([('from_node', 'to_node')]),
        ),
    ]
