# Generated by Django 4.0.1 on 2022-02-14 09:47

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),
        ('team', '0002_remove_team_first_invoice_number'),
        ('client', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Invoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('client_name', models.CharField(max_length=255)),
                ('client_email', models.CharField(max_length=255)),
                ('client_org_number', models.CharField(blank=True, max_length=255, null=True)),
                ('client_address1', models.CharField(blank=True, max_length=255, null=True)),
                ('client_address2', models.CharField(blank=True, max_length=255, null=True)),
                ('client_zipcode', models.CharField(blank=True, max_length=255, null=True)),
                ('client_place', models.CharField(blank=True, max_length=255, null=True)),
                ('client_country', models.CharField(blank=True, max_length=255, null=True)),
                ('client_contact_person', models.CharField(blank=True, max_length=255, null=True)),
                ('client_contact_reference', models.CharField(blank=True, max_length=255, null=True)),
                ('sender_reference', models.CharField(blank=True, max_length=255, null=True)),
                ('invoice_type', models.CharField(choices=[('invoice', 'Invoice'), ('credit_note', 'Credit note')], default='invoice', max_length=20)),
                ('due_days', models.IntegerField(default=14)),
                ('is_credited', models.BooleanField(default=False)),
                ('is_sent', models.BooleanField(default=False)),
                ('is_paid', models.BooleanField(default=False)),
                ('bankaccount', models.CharField(blank=True, max_length=266, null=True)),
                ('gross_amount', models.DecimalField(decimal_places=2, max_digits=6)),
                ('vat_amount', models.DecimalField(decimal_places=2, max_digits=6)),
                ('net_amount', models.DecimalField(decimal_places=2, max_digits=6)),
                ('discount_amount', models.DecimalField(decimal_places=2, max_digits=6)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('modified_at', models.DateTimeField(auto_now=True)),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='client.client')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_invoices', to=settings.AUTH_USER_MODEL)),
                ('is_credit_for', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='invoice.invoice')),
                ('modified_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='modified_invoices', to=settings.AUTH_USER_MODEL)),
                ('team', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='team.team')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255)),
                ('quantity', models.IntegerField(default=1)),
                ('unit_price', models.DecimalField(decimal_places=2, max_digits=6)),
                ('net_amount', models.DecimalField(decimal_places=2, max_digits=6)),
                ('vat_rate', models.IntegerField(default=0)),
                ('discount', models.IntegerField(default=0)),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='invoice.invoice')),
            ],
        ),
    ]
