# Generated by Django 3.2.5 on 2022-05-31 14:46

import apps.slack.models.slack_channel
import apps.slack.models.slack_usergroup
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
import django_migration_linter as linter


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('alerts', '0001_squashed_initial'),
    ]

    operations = [
        linter.IgnoreMigration(),
        migrations.CreateModel(
            name='SlackActionRecord',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('step', models.CharField(default=None, max_length=100, null=True)),
                ('payload', models.TextField(default=None, null=True)),
                ('datetime', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='SlackChannel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('public_primary_key', models.CharField(default=apps.slack.models.slack_channel.generate_public_primary_key_for_slack_channel, max_length=20, unique=True, validators=[django.core.validators.MinLengthValidator(13)])),
                ('slack_id', models.CharField(max_length=100)),
                ('name', models.CharField(max_length=500)),
                ('is_archived', models.BooleanField(default=False)),
                ('is_shared', models.BooleanField(default=None, null=True)),
                ('last_populated', models.DateField(default=None, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='SlackTeamIdentity',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('slack_id', models.CharField(max_length=100)),
                ('cached_name', models.CharField(default=None, max_length=100, null=True)),
                ('cached_app_id', models.CharField(default=None, max_length=100, null=True)),
                ('access_token', models.CharField(default=None, max_length=100, null=True)),
                ('bot_user_id', models.CharField(default=None, max_length=100, null=True)),
                ('bot_access_token', models.CharField(default=None, max_length=100, null=True)),
                ('oauth_scope', models.TextField(default=None, max_length=30000, null=True)),
                ('detected_token_revoked', models.DateTimeField(default=None, null=True, verbose_name='Deleted At')),
                ('is_profile_populated', models.BooleanField(default=False)),
                ('datetime', models.DateTimeField(auto_now_add=True)),
                ('installed_via_granular_permissions', models.BooleanField(default=True)),
                ('last_populated', models.DateTimeField(default=None, null=True)),
                ('cached_bot_id', models.CharField(default=None, max_length=100, null=True)),
                ('cached_reinstall_data', models.JSONField(default=None, null=True)),
            ],
            options={
                'ordering': ('datetime',),
            },
        ),
        migrations.CreateModel(
            name='SlackUserIdentity',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('slack_id', models.CharField(max_length=100)),
                ('cached_slack_email', models.EmailField(blank=True, default='', max_length=254)),
                ('cached_im_channel_id', models.CharField(default=None, max_length=100, null=True)),
                ('cached_phone_number', models.CharField(default=None, max_length=20, null=True)),
                ('cached_country_code', models.CharField(default=None, max_length=3, null=True)),
                ('cached_timezone', models.CharField(default=None, max_length=100, null=True)),
                ('cached_slack_login', models.CharField(default=None, max_length=100, null=True)),
                ('cached_avatar', models.URLField(default=None, null=True)),
                ('cached_name', models.CharField(default=None, max_length=200, null=True)),
                ('phone_from_onboarding', models.BooleanField(default=False)),
                ('cached_is_bot', models.BooleanField(default=None, null=True)),
                ('profile_real_name_normalized', models.CharField(default=None, max_length=200, null=True)),
                ('profile_display_name', models.CharField(default=None, max_length=200, null=True)),
                ('profile_display_name_normalized', models.CharField(default=None, max_length=200, null=True)),
                ('profile_real_name', models.CharField(default=None, max_length=200, null=True)),
                ('deleted', models.BooleanField(default=None, null=True)),
                ('is_admin', models.BooleanField(default=None, null=True)),
                ('is_owner', models.BooleanField(default=None, null=True)),
                ('is_primary_owner', models.BooleanField(default=None, null=True)),
                ('is_restricted', models.BooleanField(default=None, null=True)),
                ('is_ultra_restricted', models.BooleanField(default=None, null=True)),
                ('is_app_user', models.BooleanField(default=None, null=True)),
                ('has_2fa', models.BooleanField(default=None, null=True)),
                ('main_menu_last_opened_datetime', models.DateTimeField(default=None, null=True)),
                ('counter', models.PositiveSmallIntegerField(default=1)),
                ('is_stranger', models.BooleanField(default=False)),
                ('is_not_found', models.BooleanField(default=False)),
                ('slack_team_identity', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='slack_user_identities', to='slack.slackteamidentity')),
            ],
        ),
        migrations.CreateModel(
            name='SlackUserGroup',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('public_primary_key', models.CharField(default=apps.slack.models.slack_usergroup.generate_public_primary_key_for_slack_user_group, max_length=20, unique=True, validators=[django.core.validators.MinLengthValidator(13)])),
                ('slack_id', models.CharField(max_length=100)),
                ('name', models.CharField(max_length=500)),
                ('handle', models.CharField(max_length=500)),
                ('members', models.JSONField(blank=True, default=None, null=True)),
                ('is_active', models.BooleanField(default=False)),
                ('last_populated', models.DateField(default=None, null=True)),
                ('slack_team_identity', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='usergroups', to='slack.slackteamidentity')),
            ],
        ),
        migrations.AddField(
            model_name='slackteamidentity',
            name='installed_by',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='slack.slackuseridentity'),
        ),
        migrations.CreateModel(
            name='SlackMessage',
            fields=[
                ('id', models.CharField(default=uuid.uuid4, editable=False, max_length=36, primary_key=True, serialize=False)),
                ('slack_id', models.CharField(max_length=100)),
                ('channel_id', models.CharField(default=None, max_length=100, null=True)),
                ('ack_reminder_message_ts', models.CharField(default=None, max_length=100, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('cached_permalink', models.URLField(default=None, max_length=250, null=True)),
                ('last_updated', models.DateTimeField(default=None, null=True)),
                ('active_update_task_id', models.CharField(default=None, max_length=100, null=True)),
                ('_slack_team_identity', models.ForeignKey(db_column='slack_team_identity', default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='slack_message', to='slack.slackteamidentity')),
                ('alert_group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='slack_messages', to='alerts.alertgroup')),
            ],
        ),
    ]
