# Generated by Django 5.2.6 on 2025-09-27 22:04

import django.core.validators
import django.db.models.deletion
import django_ledger.io.io_core
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('django_ledger', '0025_alter_billmodel_cash_account_and_more'),
    ]

    operations = [
        migrations.AddField(
            model_name='stagedtransactionmodel',
            name='customer_model',
            field=models.ForeignKey(blank=True, help_text='The Customer associated with the transaction.', null=True, on_delete=django.db.models.deletion.RESTRICT, to='django_ledger.customermodel', verbose_name='Associated Customer Model'),
        ),
        migrations.AddField(
            model_name='stagedtransactionmodel',
            name='receipt_type',
            field=models.CharField(blank=True, choices=[('sales', 'Sales Receipt'), ('customer_refund', 'Sales Refund'), ('expense', 'Expense Receipt'), ('expense_refund', 'Expense Refund'), ('transfer', 'Transfer Receipt')], help_text='The receipt type of the transaction.', max_length=20, null=True, verbose_name='Receipt Type'),
        ),
        migrations.AddField(
            model_name='stagedtransactionmodel',
            name='vendor_model',
            field=models.ForeignKey(blank=True, help_text='The Vendor associated with the transaction.', null=True, on_delete=django.db.models.deletion.RESTRICT, to='django_ledger.vendormodel', verbose_name='Associated Vendor Model'),
        ),
        migrations.CreateModel(
            name='ReceiptModel',
            fields=[
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True, null=True)),
                ('markdown_notes', models.TextField(blank=True, null=True, verbose_name='Markdown Notes')),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('receipt_number', models.CharField(max_length=255, verbose_name='Receipt Number')),
                ('receipt_date', models.DateField(verbose_name='Receipt Date')),
                ('receipt_type', models.CharField(choices=[('sales', 'Sales Receipt'), ('customer_refund', 'Sales Refund'), ('expense', 'Expense Receipt'), ('expense_refund', 'Expense Refund'), ('transfer', 'Transfer Receipt')], verbose_name='Receipt Type')),
                ('amount', models.DecimalField(decimal_places=2, help_text='Amount of the receipt.', max_digits=20, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Receipt Amount')),
                ('charge_account', models.ForeignKey(help_text='The financial account (cash or credit) where this transaction was made.', on_delete=django.db.models.deletion.PROTECT, related_name='charge_receiptmodel_set', to='django_ledger.accountmodel', verbose_name='Charge Account')),
                ('customer_model', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='django_ledger.customermodel', verbose_name='Customer Model')),
                ('ledger_model', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, to='django_ledger.ledgermodel', verbose_name='Ledger Model')),
                ('receipt_account', models.ForeignKey(help_text='The income or expense account where this transaction will be reflected', on_delete=django.db.models.deletion.PROTECT, to='django_ledger.accountmodel', verbose_name='PnL Account')),
                ('staged_transaction_model', models.OneToOneField(blank=True, help_text='The staged transaction associated with the receipt from bank feeds.', null=True, on_delete=django.db.models.deletion.RESTRICT, to='django_ledger.stagedtransactionmodel', verbose_name='Staged Transaction Model')),
                ('unit_model', models.ForeignKey(blank=True, help_text='Helps segregate receipts and transactions into different classes or departments.', null=True, on_delete=django.db.models.deletion.PROTECT, to='django_ledger.entityunitmodel', verbose_name='Unit Model')),
                ('vendor_model', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='django_ledger.vendormodel', verbose_name='Vendor Model')),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model, django_ledger.io.io_core.IOMixIn),
        ),
    ]
