# Generated by Django 4.1.3 on 2022-12-16 17:12

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('medialib', '0001_initial'),
        ('location', '0002_geoip_subnet_alter_geoip_ip'),
        ('account', '0012_settings_settingsmetadata'),
    ]

    operations = [
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('reporter_ip', models.CharField(blank=True, db_index=True, default=None, max_length=16, null=True)),
                ('hostname', models.CharField(blank=True, db_index=True, default=None, max_length=255, null=True)),
                ('description', models.CharField(max_length=84)),
                ('details', models.TextField(default=None, null=True)),
                ('level', models.IntegerField(db_index=True, default=0)),
                ('category', models.CharField(db_index=True, max_length=124)),
            ],
            bases=(models.Model, rest.models.RestModel, rest.models.MetaDataModel),
        ),
        migrations.CreateModel(
            name='Incident',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('description', models.CharField(max_length=200)),
                ('priority', models.IntegerField(default=0)),
                ('state', models.IntegerField(default=0)),
                ('assigned_to', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='account.member')),
                ('group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='account.group')),
            ],
            bases=(models.Model, rest.models.RestModel, rest.models.MetaDataModel),
        ),
        migrations.CreateModel(
            name='Rule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=200)),
                ('category', models.CharField(db_index=True, max_length=200)),
                ('priority', models.IntegerField(db_index=True, default=10)),
                ('bundle', models.IntegerField(default=0)),
                ('created_by', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='account.member')),
                ('group', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='account.group')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='ServerOssecAlert',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('when', models.DateTimeField(db_index=True)),
                ('alert_id', models.CharField(default=None, max_length=64, null=True)),
                ('rule_id', models.CharField(db_index=True, default=None, max_length=64, null=True)),
                ('text', models.TextField(default=None, null=True)),
                ('action', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('ext_ip', models.CharField(blank=True, default=None, max_length=32, null=True)),
                ('src_ip', models.CharField(blank=True, default=None, max_length=32, null=True)),
                ('hostname', models.CharField(blank=True, db_index=True, default=None, max_length=128, null=True)),
                ('ip', models.CharField(blank=True, default=None, max_length=32, null=True)),
                ('username', models.CharField(default=None, max_length=64, null=True)),
                ('username2', models.CharField(default=None, max_length=64, null=True)),
                ('level', models.IntegerField(default=0)),
                ('title', models.CharField(blank=True, default=None, max_length=200, null=True)),
                ('geoip', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='location.geoip')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='RuleCheck',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=200)),
                ('index', models.IntegerField(default=0)),
                ('comparator', models.CharField(default='==', max_length=32)),
                ('field_name', models.CharField(default=None, max_length=124, null=True)),
                ('value', models.CharField(default='', max_length=124)),
                ('value_type', models.IntegerField(default=0)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='incident.rule')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='IncidentMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('key', models.CharField(db_index=True, max_length=80)),
                ('value_format', models.CharField(max_length=16)),
                ('value', models.TextField()),
                ('int_value', models.IntegerField(blank=True, default=None, null=True)),
                ('float_value', models.IntegerField(blank=True, default=None, null=True)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='properties', to='incident.incident')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='IncidentHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('kind', models.CharField(blank=True, db_index=True, default=None, max_length=80, null=True)),
                ('state', models.IntegerField(default=0)),
                ('priority', models.IntegerField(default=0)),
                ('note', models.TextField(blank=True, default=None, null=True)),
                ('by', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='account.member')),
                ('group', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='account.group')),
                ('media', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='medialib.mediaitem')),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='history', to='incident.incident')),
                ('to', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='account.member')),
            ],
            options={
                'ordering': ['-created'],
            },
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.AddField(
            model_name='incident',
            name='rule',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='incident.rule'),
        ),
        migrations.CreateModel(
            name='EventMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('key', models.CharField(db_index=True, max_length=80)),
                ('value_format', models.CharField(max_length=16)),
                ('value', models.TextField()),
                ('int_value', models.IntegerField(blank=True, default=None, null=True)),
                ('float_value', models.IntegerField(blank=True, default=None, null=True)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='properties', to='incident.event')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='event',
            name='incident',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='incident.incident'),
        ),
    ]
