# Generated by Django 3.1.4 on 2020-12-14 09:30

import django.contrib.gis.db.models.fields
from django.contrib.postgres.operations import CreateExtension
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        CreateExtension('postgis'),
        migrations.CreateModel(
            name='ServiceArea',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Название')),
                ('geometry', django.contrib.gis.db.models.fields.PolygonField(srid=4326, verbose_name='Область')),
            ],
            options={
                'verbose_name': 'Область обслуживания',
                'verbose_name_plural': 'Области обслуживания',
            },
        ),
        migrations.CreateModel(
            name='ServiceType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True, verbose_name='Название')),
            ],
            options={
                'verbose_name': 'Тип услуг',
                'verbose_name_plural': 'Типы услуг',
            },
        ),
        migrations.CreateModel(
            name='Supplier',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True, verbose_name='Название организации')),
                ('email', models.CharField(max_length=255)),
                ('phone', models.CharField(max_length=20, verbose_name='Номер телефона')),
                ('address', models.TextField(verbose_name='Адрес центрального офиса')),
            ],
            options={
                'verbose_name': 'Поставщик',
                'verbose_name_plural': 'Поставщики',
            },
        ),
        migrations.CreateModel(
            name='TypeInArea',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.IntegerField(verbose_name='цена обслуживания за единицу оказываемой услуги')),
                ('area', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='suppliers.servicearea')),
                ('service_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='suppliers.servicetype')),
            ],
        ),
        migrations.AddField(
            model_name='servicearea',
            name='supplier',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='suppliers.supplier'),
        ),
        migrations.AddField(
            model_name='servicearea',
            name='types',
            field=models.ManyToManyField(through='suppliers.TypeInArea', to='suppliers.ServiceType', verbose_name='Типы обслуживания'),
        ),
    ]
