# Generated by Django 4.2.5 on 2024-04-09 20:21

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


class Migration(migrations.Migration):

    dependencies = [
        ('osinacore', '0065_alter_customerprofile_status'),
        ('billing', '0018_alter_order_status'),
    ]

    operations = [
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('amount', models.FloatField(null=True)),
                ('recurring', models.BooleanField(default=False)),
                ('created_at', models.DateField(blank=True, null=True)),
                ('cancelled_at', models.DateField(blank=True, null=True)),
                ('active', models.BooleanField(default=True, null=True)),
                ('project', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='osinacore.project')),
                ('recurring_cycle', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='billing.recurringcycle')),
                ('type', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='osinacore.projecttype')),
            ],
        ),
        migrations.CreateModel(
            name='OrderPayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=3, max_digits=5)),
                ('date_paid', models.DateField()),
                ('comment', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.RemoveField(
            model_name='service',
            name='customer',
        ),
        migrations.RemoveField(
            model_name='service',
            name='order',
        ),
        migrations.RemoveField(
            model_name='service',
            name='project',
        ),
        migrations.RemoveField(
            model_name='service',
            name='recurring_cycle',
        ),
        migrations.RemoveField(
            model_name='service',
            name='type',
        ),
        migrations.RemoveField(
            model_name='servicepayment',
            name='charge',
        ),
        migrations.RemoveField(
            model_name='servicepayment',
            name='type',
        ),
        migrations.RemoveField(
            model_name='invoice',
            name='charge',
        ),
        migrations.AddField(
            model_name='invoice',
            name='order',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='billing.order'),
        ),
        migrations.AddField(
            model_name='order',
            name='due_date',
            field=models.DateField(null=True),
        ),
        migrations.AddField(
            model_name='order',
            name='paid',
            field=models.BooleanField(default=False, null=True),
        ),
        migrations.DeleteModel(
            name='Charge',
        ),
        migrations.DeleteModel(
            name='Service',
        ),
        migrations.DeleteModel(
            name='ServicePayment',
        ),
        migrations.AddField(
            model_name='orderpayment',
            name='order',
            field=models.ManyToManyField(null=True, to='billing.order'),
        ),
        migrations.AddField(
            model_name='orderpayment',
            name='type',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='billing.paymenttype'),
        ),
        migrations.AlterField(
            model_name='receipt',
            name='payment',
            field=models.ManyToManyField(to='billing.orderpayment'),
        ),
    ]
