# Generated by Django 3.0.13 on 2021-04-08 09:59

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

import pretix.base.models.base


class Migration(migrations.Migration):

    dependencies = [
        ('pretixbase', '0184_customer'),
    ]

    operations = [
        migrations.AddField(
            model_name='item',
            name='grant_membership_duration_days',
            field=models.IntegerField(default=0),
        ),
        migrations.AddField(
            model_name='item',
            name='grant_membership_duration_like_event',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='item',
            name='grant_membership_duration_months',
            field=models.IntegerField(default=0),
        ),
        migrations.AddField(
            model_name='item',
            name='require_membership',
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name='itemvariation',
            name='require_membership',
            field=models.BooleanField(default=False),
        ),
        migrations.CreateModel(
            name='MembershipType',
            fields=[
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('name', i18nfield.fields.I18nCharField()),
                ('transferable', models.BooleanField(default=False)),
                ('allow_parallel_usage', models.BooleanField(default=False)),
                ('max_usages', models.PositiveIntegerField(null=True)),
                ('organizer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='membership_types', to='pretixbase.Organizer')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model, pretix.base.models.base.LoggingMixin),
        ),
        migrations.CreateModel(
            name='Membership',
            fields=[
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('date_start', models.DateTimeField()),
                ('date_end', models.DateTimeField()),
                ('attendee_name_parts', models.JSONField(default=dict, null=True)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='memberships', to='pretixbase.Customer')),
                ('granted_in', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='granted_memberships', to='pretixbase.OrderPosition', null=True)),
                ('membership_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='memberships', to='pretixbase.MembershipType')),
            ],
        ),
        migrations.AddField(
            model_name='cartposition',
            name='used_membership',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='pretixbase.Membership'),
        ),
        migrations.AddField(
            model_name='item',
            name='grant_membership_type',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='granted_by', to='pretixbase.MembershipType'),
        ),
        migrations.AddField(
            model_name='item',
            name='require_membership_types',
            field=models.ManyToManyField(to='pretixbase.MembershipType'),
        ),
        migrations.AddField(
            model_name='itemvariation',
            name='require_membership_types',
            field=models.ManyToManyField(to='pretixbase.MembershipType'),
        ),
        migrations.AddField(
            model_name='orderposition',
            name='used_membership',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='pretixbase.Membership'),
        ),
    ]
