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


class Migration(migrations.Migration):
    """
    Additive only. Gives a domain product its sale method, its reservation fee
    and the hold that fee buys. Nothing existing is altered or removed.
    """

    dependencies = [
        ('ecommerce', '0032_emaillog_alert_type'),
    ]

    operations = [
        migrations.AddField(
            model_name='product',
            name='sale_method',
            field=models.CharField(
                choices=[('fixed', 'Fixed price'), ('offer', 'Offers over minimum')],
                default='fixed',
                help_text='Fixed price, or open to offers above a minimum',
                max_length=10,
            ),
        ),
        migrations.AddField(
            model_name='product',
            name='reservation_fee',
            field=models.DecimalField(
                blank=True, decimal_places=2,
                help_text='Paid to hold this item. Comes off the final price.',
                max_digits=10, null=True,
            ),
        ),
        migrations.AddField(
            model_name='product',
            name='reserved_until',
            field=models.DateTimeField(
                blank=True,
                help_text='Reservation lapses after this, five working days from payment',
                null=True,
            ),
        ),
        migrations.AddField(
            model_name='product',
            name='reserved_order',
            field=models.ForeignKey(
                blank=True,
                help_text='The order that paid the reservation fee',
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name='reserved_products',
                to='ecommerce.order',
            ),
        ),
    ]
