# Generated by Django 5.2.7 on 2026-02-02 16:46

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0013_heldsale'),
    ]

    operations = [
        migrations.CreateModel(
            name='LoyaltyTier',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name_en', models.CharField(max_length=50, verbose_name='Name (English)')),
                ('name_ar', models.CharField(max_length=50, verbose_name='Name (Arabic)')),
                ('min_points', models.PositiveIntegerField(default=0, verbose_name='Minimum Points')),
                ('point_multiplier', models.DecimalField(decimal_places=2, default=1.0, max_digits=4, verbose_name='Point Multiplier')),
                ('discount_percentage', models.DecimalField(decimal_places=2, default=0, max_digits=5, verbose_name='Discount Percentage')),
                ('color_code', models.CharField(default='#6c757d', max_length=20, verbose_name='Color Code')),
            ],
        ),
        migrations.AddField(
            model_name='customer',
            name='loyalty_points',
            field=models.DecimalField(decimal_places=2, default=0, max_digits=15, verbose_name='Loyalty Points'),
        ),
        migrations.AddField(
            model_name='sale',
            name='loyalty_discount_amount',
            field=models.DecimalField(decimal_places=3, default=0, max_digits=15, verbose_name='Loyalty Discount'),
        ),
        migrations.AddField(
            model_name='sale',
            name='loyalty_points_redeemed',
            field=models.DecimalField(decimal_places=2, default=0, max_digits=15, verbose_name='Loyalty Points Redeemed'),
        ),
        migrations.AddField(
            model_name='systemsetting',
            name='currency_per_point',
            field=models.DecimalField(decimal_places=3, default=0.01, max_digits=10, verbose_name='Currency Value per Point'),
        ),
        migrations.AddField(
            model_name='systemsetting',
            name='loyalty_enabled',
            field=models.BooleanField(default=False, verbose_name='Enable Loyalty System'),
        ),
        migrations.AddField(
            model_name='systemsetting',
            name='min_points_to_redeem',
            field=models.PositiveIntegerField(default=100, verbose_name='Minimum Points to Redeem'),
        ),
        migrations.AddField(
            model_name='systemsetting',
            name='points_per_currency',
            field=models.DecimalField(decimal_places=2, default=1.0, max_digits=10, verbose_name='Points Earned per Currency Unit'),
        ),
        migrations.AddField(
            model_name='customer',
            name='loyalty_tier',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='customers', to='core.loyaltytier'),
        ),
        migrations.CreateModel(
            name='LoyaltyTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_type', models.CharField(choices=[('earned', 'Earned'), ('redeemed', 'Redeemed'), ('adjusted', 'Adjusted')], max_length=20, verbose_name='Type')),
                ('points', models.DecimalField(decimal_places=2, max_digits=15, verbose_name='Points')),
                ('notes', models.TextField(blank=True, verbose_name='Notes')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='loyalty_transactions', to='core.customer')),
                ('sale', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='loyalty_transactions', to='core.sale')),
            ],
        ),
    ]
