# Generated by Django 2.2.5 on 2020-12-01 14:25

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


class Migration(migrations.Migration):

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

    operations = [
        migrations.AlterModelOptions(
            name='discount',
            options={'verbose_name': 'Discount', 'verbose_name_plural': 'Discount'},
        ),
        migrations.AddField(
            model_name='discount',
            name='case_sensitive',
            field=models.BooleanField(default=True, verbose_name='Case Sensitive'),
        ),
        migrations.AlterField(
            model_name='discount',
            name='code',
            field=models.CharField(max_length=20, verbose_name='Code'),
        ),
        migrations.AlterField(
            model_name='discount',
            name='title',
            field=models.CharField(max_length=100, verbose_name='Title'),
        ),
        migrations.AlterField(
            model_name='discount',
            name='type',
            field=models.CharField(choices=[('percent', 'درصدی'), ('fixed', 'مقدار ثابت')], default='percent', max_length=10, verbose_name='Discount type'),
        ),
        migrations.AlterField(
            model_name='discount',
            name='value',
            field=models.PositiveIntegerField(default=0, verbose_name='Discount value'),
        ),
        migrations.CreateModel(
            name='UsedDiscount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(blank=True, max_length=20, null=True, verbose_name='Code used in that moment')),
                ('item_type', models.CharField(choices=[('hotel', 'هتل'), ('room', 'اتاق')], default='hotel', max_length=10, verbose_name='Item type which user is trying to purchase or own')),
                ('item_id', models.IntegerField(blank=True, null=True, verbose_name='Type of item to purchase or own')),
                ('discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='usages', to='django_discount.Discount', verbose_name='Discount')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discounts', to=settings.AUTH_USER_MODEL, verbose_name='User who used discount code')),
            ],
            options={
                'verbose_name': 'Used Discount',
                'verbose_name_plural': 'Used Discount',
                'db_table': 'discount_used_record',
            },
        ),
    ]
