# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-30 21:13


from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import simple_history.models
import uuid


class Migration(migrations.Migration):

    dependencies = [
        ('student', '0021_historicalcourseenrollment'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('entitlements', '0010_backfill_refund_lock'),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalCourseEntitlement',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)),
                ('course_uuid', models.UUIDField(help_text=u'UUID for the Course, not the Course Run')),
                ('expired_at', models.DateTimeField(blank=True, help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True)),
                ('mode', models.CharField(help_text=u'The mode of the Course that will be applied on enroll.', max_length=100)),
                ('order_number', models.CharField(max_length=128, null=True)),
                ('refund_locked', models.BooleanField(default=False)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('_policy', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='entitlements.CourseEntitlementPolicy')),
                ('enrollment_course_run', models.ForeignKey(blank=True, db_constraint=False, help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='student.CourseEnrollment')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
                'verbose_name': 'historical course entitlement',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
