# Generated by Django 4.0 on 2022-01-02 19:50

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('uauth', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('short_name', models.CharField(max_length=3, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='PricePerTime',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.FloatField()),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.currency')),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('unit', models.CharField(max_length=128, unique=True)),
                ('minimum_units', models.FloatField(blank=True, null=True)),
                ('maximum_units', models.FloatField(blank=True, null=True)),
                ('step_size', models.FloatField(default=1)),
                ('price_per_time', models.ManyToManyField(blank=True, to='app.PricePerTime')),
            ],
        ),
        migrations.CreateModel(
            name='TimeFrame',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('seconds', models.IntegerField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='ResourceOrder',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.FloatField()),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.resource')),
                ('timeframe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.timeframe')),
            ],
        ),
        migrations.CreateModel(
            name='ProductOrder',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.product')),
                ('resources', models.ManyToManyField(to='app.ResourceOrder')),
            ],
        ),
        migrations.AddField(
            model_name='product',
            name='resources',
            field=models.ManyToManyField(to='app.Resource'),
        ),
        migrations.AddField(
            model_name='pricepertime',
            name='timeframe',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.timeframe'),
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_date', models.DateTimeField(auto_now_add=True)),
                ('starting_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('ending_date', models.DateTimeField(blank=True, null=True)),
                ('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='uauth.user')),
                ('product', models.ManyToManyField(blank=True, to='app.ProductOrder')),
            ],
        ),
    ]
