# Generated by Django 3.2 on 2021-06-02 10:36

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sessions', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Affiliate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField()),
                ('updated', models.DateTimeField()),
                ('name', models.CharField(max_length=100, verbose_name='Affiliate name')),
                ('description', models.CharField(blank=True, max_length=1000, null=True, verbose_name='Affiliate description')),
                ('aid', models.CharField(max_length=6, unique=True, verbose_name='Affiliate ID')),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name_plural': 'Affiliates',
                'ordering': ['-timestamp'],
            },
        ),
        migrations.CreateModel(
            name='Label',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField()),
                ('updated', models.DateTimeField()),
                ('name', models.CharField(max_length=100, verbose_name='Label name')),
                ('description', models.CharField(blank=True, max_length=1000, null=True, verbose_name='Label description')),
                ('label', models.CharField(max_length=6, unique=True, verbose_name='Label ID')),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name_plural': 'Labels',
                'ordering': ['-timestamp'],
            },
        ),
        migrations.CreateModel(
            name='AffiliateTracker',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField()),
                ('updated', models.DateTimeField()),
                ('log_in_count', models.IntegerField(default=0)),
                ('ip_address', models.CharField(blank=True, max_length=250, null=True)),
                ('user_agent', models.CharField(blank=True, max_length=1000, null=True)),
                ('device', models.CharField(blank=True, default='', max_length=200, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('affiliate', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='affiliate.affiliate')),
                ('label', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='affiliate.label')),
                ('session', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='sessions.session')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Affiliate Tracker',
                'ordering': ['-timestamp'],
            },
        ),
        migrations.AddField(
            model_name='affiliate',
            name='label',
            field=models.ManyToManyField(blank=True, to='affiliate.Label'),
        ),
    ]
