# Generated by Django 5.2.5 on 2025-10-16 12:07

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('events', '0002_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='DiscountCode',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('code', models.CharField(max_length=64, unique=True)),
                ('type', models.CharField(choices=[('percent', 'Percent'), ('fixed', 'Fixed (IRR)')], default='percent', max_length=10)),
                ('value', models.PositiveIntegerField()),
                ('max_discount', models.PositiveIntegerField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('starts_at', models.DateTimeField(blank=True, null=True)),
                ('ends_at', models.DateTimeField(blank=True, null=True)),
                ('usage_limit_total', models.PositiveIntegerField(blank=True, null=True)),
                ('usage_limit_per_user', models.PositiveIntegerField(blank=True, null=True)),
                ('min_amount', models.PositiveIntegerField(blank=True, null=True)),
                ('applicable_events', models.ManyToManyField(blank=True, related_name='discount_codes', to='events.event')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('base_amount', models.PositiveIntegerField(editable=False)),
                ('discount_amount', models.PositiveIntegerField(default=0, editable=False)),
                ('amount', models.PositiveIntegerField(editable=False)),
                ('authority', models.CharField(blank=True, editable=False, max_length=64, null=True, unique=True)),
                ('status', models.IntegerField(choices=[(0, 'Initiated'), (1, 'Pending'), (2, 'Paid'), (3, 'Failed'), (4, 'Canceled')], default=0, editable=False)),
                ('ref_id', models.CharField(blank=True, editable=False, max_length=64, null=True)),
                ('card_pan', models.CharField(blank=True, editable=False, max_length=32, null=True)),
                ('card_hash', models.CharField(blank=True, editable=False, max_length=128, null=True)),
                ('verified_at', models.DateTimeField(blank=True, editable=False, null=True)),
                ('discount_code', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='payments', to='payments.discountcode')),
                ('event', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='payments', to='events.event')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
