# Generated by Django 4.0.1 on 2022-02-04 13:28

import core.utils.helper
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='CustomPermission',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated_at')),
                ('data', models.JSONField(blank=True, null=True)),
                ('name', models.CharField(max_length=60, unique=True, verbose_name='Official_name')),
                ('codename', models.CharField(max_length=150, unique=True, verbose_name='Codename')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created_at')),
            ],
            options={
                'verbose_name': 'CustomPermission',
                'verbose_name_plural': 'CustomPermissions',
                'db_table': 'custompermission',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='MProvider',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created_at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated_at')),
                ('site', models.CharField(max_length=300, verbose_name='Site')),
                ('data', models.JSONField(default=core.utils.helper.defaultMProviderData, verbose_name='Data')),
            ],
            options={
                'verbose_name': 'MProvider',
                'verbose_name_plural': 'MProviders',
                'db_table': 'mprovider',
                'ordering': ['-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='Organization',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created_at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated_at')),
                ('data', models.JSONField(blank=True, null=True)),
                ('name', models.CharField(max_length=150, unique=True, verbose_name='Name')),
                ('description', models.CharField(max_length=500, verbose_name='Description')),
                ('address', models.CharField(max_length=200, verbose_name='Address')),
                ('logo', models.TextField(blank=True, null=True, verbose_name='Logo')),
                ('numbers', models.JSONField(blank=True, null=True)),
                ('links', models.JSONField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Organization',
                'verbose_name_plural': 'Organizations',
                'db_table': 'organization',
                'ordering': ['-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created_at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated_at')),
                ('data', models.JSONField(blank=True, null=True)),
                ('prefix', models.CharField(max_length=10, unique=True, verbose_name='Prefix')),
                ('name', models.CharField(max_length=150, unique=True, verbose_name='Name')),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(max_length=128, region=None, unique=True, verbose_name='Phone')),
                ('address', models.CharField(max_length=200, verbose_name='Address')),
                ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organization_services', to='Organizations.organization', verbose_name='Organization')),
            ],
            options={
                'verbose_name': 'Service',
                'verbose_name_plural': 'Services',
                'db_table': 'service',
                'ordering': ['-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created_at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated_at')),
                ('data', models.JSONField(blank=True, null=True)),
                ('name', models.CharField(max_length=100, verbose_name='Name')),
                ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organization_roles', to='Organizations.organization', verbose_name='Organization')),
                ('permissions', models.ManyToManyField(related_name='permission_roles', to='Organizations.CustomPermission', verbose_name='Permissions')),
            ],
            options={
                'verbose_name': 'Role',
                'verbose_name_plural': 'Roles',
                'db_table': 'role',
                'ordering': ['-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='Organization_member',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created_at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated_at')),
                ('data', models.JSONField(blank=True, null=True)),
                ('surname', models.CharField(blank=True, max_length=150, null=True, verbose_name='Surname')),
                ('first_name', models.CharField(blank=True, max_length=150, null=True, verbose_name='First name')),
                ('second_name', models.CharField(blank=True, max_length=150, null=True, verbose_name='Second name')),
                ('email', models.CharField(blank=True, max_length=100, null=True, validators=[django.core.validators.EmailValidator], verbose_name='Email')),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, verbose_name='Phone')),
                ('address', models.CharField(blank=True, max_length=200, null=True, verbose_name='Address')),
                ('avatar', models.TextField(blank=True, null=True, verbose_name='Avatar')),
                ('pass_series', models.CharField(blank=True, max_length=4, null=True, verbose_name='Passport series')),
                ('pass_number', models.CharField(blank=True, max_length=6, null=True, verbose_name='Passport number')),
                ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organization_members', to='Organizations.organization', verbose_name='Organization')),
                ('role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='role_member', to='Organizations.role', verbose_name='Role')),
            ],
            options={
                'verbose_name': 'Organization member',
                'verbose_name_plural': 'Organizations members',
                'db_table': 'organization_member',
                'ordering': ['-updated_at'],
            },
        ),
    ]
