# Generated by Django 2.2.13 on 2021-09-20 13:22

from django.db import migrations, models
import oscar.models.fields.autoslugfield


class Migration(migrations.Migration):
    dependencies = [
        ("address", "0008_useraddress_email"),
        ("shipping", "0004_weightbased_free_shipping_threshold"),
    ]

    operations = [
        migrations.CreateModel(
            name="ProductBased",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "code",
                    oscar.models.fields.autoslugfield.AutoSlugField(
                        blank=True,
                        editable=False,
                        max_length=128,
                        populate_from="name",
                        unique=True,
                        verbose_name="Slug",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        db_index=True, max_length=128, unique=True, verbose_name="Name"
                    ),
                ),
                (
                    "description",
                    models.TextField(blank=True, verbose_name="Description"),
                ),
                (
                    "free_shipping_threshold",
                    models.DecimalField(
                        blank=True,
                        decimal_places=2,
                        max_digits=12,
                        null=True,
                        verbose_name="Free Shipping",
                    ),
                ),
                (
                    "use_highest_shipping_cost",
                    models.BooleanField(
                        default=True,
                        help_text="If this option is checked, it will use the highest price from the products that are in the users basket, otherwise it will use the lowest price.",
                        verbose_name="Use highest product shipping cost",
                    ),
                ),
                (
                    "is_only_shipping_method",
                    models.BooleanField(
                        default=False,
                        help_text="If the users basket has a product with the shipping_cost attribute set, should it only show this shipping method and hide others?",
                        verbose_name="Is only shipping method",
                    ),
                ),
                (
                    "countries",
                    models.ManyToManyField(
                        blank=True, to="address.Country", verbose_name="Countries"
                    ),
                ),
            ],
            options={
                "verbose_name": "Product attribut based shipping method",
                "verbose_name_plural": "Product attribute based shipping methods",
                "ordering": ["name"],
                "abstract": False,
            },
        ),
    ]
