# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-11 22:39
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('catalog', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Listing',
            fields=[
                ('listing_id', models.CharField(max_length=32, primary_key=True, serialize=False)),
                ('listing_url', models.URLField(max_length=512)),
                ('title', models.CharField(max_length=256)),
                ('sale_type', models.IntegerField(choices=[(0, 'Auction'), (1, 'BuyItNow')], default=0, null=True)),
                ('condition', models.IntegerField(choices=[(0, 'Used'), (1, 'New')], default=0, null=True)),
                ('start_time', models.DateTimeField()),
                ('end_time', models.DateTimeField()),
                ('seller_user_id', models.CharField(max_length=64)),
                ('bid_count', models.IntegerField(default=0, null=True)),
                ('start_price', models.DecimalField(decimal_places=2, max_digits=6, null=True)),
                ('start_price_currency', models.CharField(max_length=3, null=True)),
                ('current_price', models.DecimalField(decimal_places=2, max_digits=6, null=True)),
                ('current_price_currency', models.CharField(max_length=3, null=True)),
                ('shipping_cost', models.DecimalField(decimal_places=2, max_digits=6, null=True)),
                ('shipping_cost_currency', models.CharField(max_length=3, null=True)),
                ('buyitnow_price', models.DecimalField(decimal_places=2, max_digits=6, null=True)),
                ('buyitnow_price_currency', models.CharField(max_length=3, null=True)),
                ('brickset_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='SetInAListing',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.IntegerField(default=1, help_text='How many of this set are in this listing?')),
                ('catalog_set', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalog.CatalogSet')),
                ('market_listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='market.Listing')),
            ],
            options={
                'verbose_name': 'Set in a listing',
                'verbose_name_plural': 'Sets in listings',
            },
        ),
        migrations.AddField(
            model_name='listing',
            name='catalog_sets',
            field=models.ManyToManyField(through='market.SetInAListing', to='catalog.CatalogSet'),
        ),
    ]
