# Generated by Django 5.2.11 on 2026-04-20 17:50

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


class Migration(migrations.Migration):

    dependencies = [
        ('companies', '0006_companysettings_auto_print_on_sale_and_more'),
        ('inventory', '0014_productbundle_productvariant_bundleitem_and_more'),
        ('sales', '0014_add_analytics_refund'),
    ]

    operations = [
        migrations.AddField(
            model_name='posorder',
            name='source',
            field=models.CharField(choices=[('pos', 'POS Terminal'), ('online', 'Online Store'), ('table', 'Table QR Checkout')], db_index=True, default='pos', max_length=10),
        ),
        migrations.AlterField(
            model_name='posorder',
            name='cashier',
            field=models.CharField(db_index=True, max_length=100),
        ),
        migrations.AlterField(
            model_name='posorder',
            name='created_at',
            field=models.DateTimeField(auto_now_add=True, db_index=True),
        ),
        migrations.CreateModel(
            name='PriceList',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='e.g. Wholesale Rate, VIP, Staff', max_length=100)),
                ('is_default', models.BooleanField(default=False, help_text='Apply to all unassigned customers')),
                ('is_active', models.BooleanField(default=True)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_lists', to='companies.company')),
            ],
            options={
                'verbose_name': 'Price List',
                'verbose_name_plural': 'Price Lists',
                'ordering': ['name'],
                'unique_together': {('company', 'name')},
            },
        ),
        migrations.AddField(
            model_name='customer',
            name='price_list',
            field=models.ForeignKey(blank=True, help_text='When set, prices from this list override retail prices at POS', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='customers', to='sales.pricelist'),
        ),
        migrations.CreateModel(
            name='PriceListItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('override_price', models.DecimalField(decimal_places=2, max_digits=10)),
                ('price_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='sales.pricelist')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.product')),
                ('variant', models.ForeignKey(blank=True, help_text='Leave blank to apply override to all variants of this product', null=True, on_delete=django.db.models.deletion.CASCADE, to='inventory.productvariant')),
            ],
            options={
                'verbose_name': 'Price List Item',
                'verbose_name_plural': 'Price List Items',
                'unique_together': {('price_list', 'product', 'variant')},
            },
        ),
    ]
