# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-28 19:01
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Rule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, verbose_name='Name')),
                ('description', models.CharField(max_length=256, null=True, verbose_name='Description')),
                ('message', models.CharField(max_length=256, verbose_name='Message')),
                ('method', models.CharField(max_length=256, verbose_name='Method')),
            ],
            options={
                'verbose_name': 'Rule',
                'verbose_name_plural': 'Rules',
            },
        ),
        migrations.CreateModel(
            name='TopologyError',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id_a', models.PositiveIntegerField()),
                ('object_id_b', models.PositiveIntegerField(null=True)),
                ('content_type_a', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='errors_a', to='contenttypes.ContentType')),
                ('content_type_b', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='errors_b', to='contenttypes.ContentType')),
            ],
            options={
                'verbose_name': 'Topology Error',
                'verbose_name_plural': 'Topology Errors',
            },
        ),
        migrations.CreateModel(
            name='TopologyRule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('geom_field_a', models.CharField(default='geom', max_length=128, verbose_name='Geometry Field A')),
                ('geom_field_b', models.CharField(max_length=128, null=True, verbose_name='Geometry Field B')),
                ('tolerance', models.FloatField(null=True, verbose_name='Tolerance')),
                ('raises_error', models.BooleanField(default=False, help_text='If this raises an error, the user will not be able to save a new or existing object, if it fails on validation.', verbose_name='Raises Error?')),
                ('level', models.CharField(choices=[('WARNING', 'Warning'), ('ERROR', 'Error')], default='WARNING', max_length=32, verbose_name='Error Level')),
                ('custom_message', models.CharField(help_text='Supports interpolation for placeholders model_a, model_b and rule.', max_length=512, null=True, verbose_name='Custom Message')),
                ('content_type_a', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topology_rules_a', to='contenttypes.ContentType', verbose_name='Model A')),
                ('content_type_b', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='topology_rules_b', to='contenttypes.ContentType', verbose_name='Model B')),
                ('rule', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='topology.Rule', verbose_name='Rule')),
            ],
            options={
                'verbose_name': 'Topology Rule',
                'verbose_name_plural': 'Topology Rules',
            },
        ),
        migrations.AddField(
            model_name='topologyerror',
            name='topology_rule',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='topology.TopologyRule', verbose_name='Topology Rule'),
        ),
    ]
