# Generated by Django 3.1.7 on 2021-02-27 05:02

import dealership.models
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),
    ]

    operations = [
        migrations.CreateModel(
            name='CarColorOption',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('color_name', models.CharField(max_length=128)),
            ],
        ),
        migrations.CreateModel(
            name='CarMakeOption',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_name', models.CharField(max_length=128)),
            ],
        ),
        migrations.CreateModel(
            name='Dealership',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('year_established', models.IntegerField(validators=[dealership.models.year_validator])),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CarModelOption',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('model_name', models.CharField(max_length=128)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dealership.carmakeoption')),
            ],
        ),
        migrations.CreateModel(
            name='Car',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField(validators=[dealership.models.year_validator])),
                ('mileage', models.IntegerField(validators=[dealership.models.is_not_negative])),
                ('list_price_cents', models.IntegerField(help_text='Listing price from the dealership (in cents).', validators=[dealership.models.is_not_negative], verbose_name='List Price')),
                ('sold_price_cents', models.IntegerField(blank=True, help_text='What the dealership is selling it for (in cents)', null=True, validators=[dealership.models.is_not_negative], verbose_name='Sold Price')),
                ('sold_date', models.DateField(blank=True, help_text='Date the car was sold. No value means the car has not been sold yet.', null=True)),
                ('color', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='dealership.carcoloroption')),
                ('dealership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cars', to='dealership.dealership')),
                ('make', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='dealership.carmakeoption')),
                ('model', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='dealership.carmodeloption')),
            ],
        ),
    ]
