from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('finance_and_accounting', '0010_accounting_settings'),
    ]

    operations = [
        migrations.CreateModel(
            name='CurrencyExchangeRate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('from_currency', models.CharField(default='usd', max_length=10)),
                ('to_currency', models.CharField(default='kes', max_length=10)),
                ('rate_date', models.DateField()),
                ('exchange_rate', models.DecimalField(decimal_places=6, default=1, max_digits=18)),
                ('notes', models.CharField(blank=True, default='', max_length=300)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('company_branch', models.ForeignKey(null=True, on_delete=models.deletion.CASCADE, related_name='currency_exchange_rates', to='system_administration.companybranch')),
                ('created_by', models.ForeignKey(null=True, on_delete=models.deletion.SET_NULL, related_name='fx_rate_created_by', to='human_resource.staffprofile')),
            ],
            options={'ordering': ['-rate_date', '-id'], 'unique_together': {('company_branch', 'from_currency', 'to_currency', 'rate_date')}},
        ),
        migrations.CreateModel(
            name='FinanceAuditLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('entity_type', models.CharField(max_length=80)),
                ('entity_id', models.CharField(max_length=50)),
                ('action', models.CharField(max_length=50)),
                ('notes', models.TextField(blank=True, default='')),
                ('before_data', models.TextField(blank=True, default='')),
                ('after_data', models.TextField(blank=True, default='')),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('actor', models.ForeignKey(null=True, on_delete=models.deletion.SET_NULL, related_name='finance_audit_actions', to='human_resource.staffprofile')),
                ('company_branch', models.ForeignKey(null=True, on_delete=models.deletion.CASCADE, related_name='finance_audit_logs', to='system_administration.companybranch')),
            ],
            options={'ordering': ['-created_on']},
        ),
        migrations.CreateModel(
            name='VendorInvoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('supplier_invoice_number', models.CharField(default='', max_length=100)),
                ('invoice_date', models.DateField()),
                ('invoice_amount', models.CharField(default='0.00', max_length=50)),
                ('po_amount', models.CharField(default='0.00', max_length=50)),
                ('received_amount', models.CharField(default='0.00', max_length=50)),
                ('match_status', models.CharField(choices=[('pending', 'Pending'), ('matched', 'Matched'), ('partial', 'Partial Match'), ('exception', 'Exception')], default='pending', max_length=20)),
                ('match_notes', models.TextField(blank=True, default='')),
                ('attachment_reference', models.CharField(blank=True, default='', max_length=200)),
                ('account_manager_id', models.CharField(blank=True, default='', max_length=50)),
                ('recycle_bin', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('last_updated_on', models.DateTimeField(auto_now=True)),
                ('company_branch', models.ForeignKey(null=True, on_delete=models.deletion.SET_NULL, related_name='vendor_invoices', to='system_administration.companybranch')),
                ('created_by', models.ForeignKey(null=True, on_delete=models.deletion.SET_NULL, related_name='vendor_invoice_created_by', to='human_resource.staffprofile')),
                ('purchase_order', models.ForeignKey(null=True, on_delete=models.deletion.SET_NULL, related_name='vendor_invoices', to='procurement.purchaseorder')),
            ],
        ),
        migrations.CreateModel(
            name='TaxLossCarryForward',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tax_year', models.PositiveIntegerField()),
                ('assessed_loss', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('utilized', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('balance', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('notes', models.TextField(blank=True, default='')),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('company_branch', models.ForeignKey(null=True, on_delete=models.deletion.CASCADE, related_name='tax_loss_carry_forwards', to='system_administration.companybranch')),
            ],
            options={'unique_together': {('company_branch', 'tax_year')}},
        ),
        migrations.CreateModel(
            name='DepreciationScheduleLine',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('period_month', models.DateField()),
                ('depreciation_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('posted', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('asset', models.ForeignKey(on_delete=models.deletion.CASCADE, related_name='depreciation_schedule', to='finance_and_accounting.asset')),
                ('journal_entry', models.ForeignKey(blank=True, null=True, on_delete=models.deletion.SET_NULL, related_name='depreciation_lines', to='finance_and_accounting.manualjournalentry')),
            ],
            options={'ordering': ['period_month'], 'unique_together': {('asset', 'period_month')}},
        ),
        migrations.CreateModel(
            name='MpesaStatementLine',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_date', models.DateField()),
                ('reference_code', models.CharField(default='', max_length=100)),
                ('payer_name', models.CharField(blank=True, default='', max_length=200)),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('matched', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('company_branch', models.ForeignKey(null=True, on_delete=models.deletion.CASCADE, related_name='mpesa_statement_lines', to='system_administration.companybranch')),
                ('matched_history', models.ForeignKey(blank=True, null=True, on_delete=models.deletion.SET_NULL, related_name='mpesa_matches', to='finance_and_accounting.accounthistory')),
                ('mpesa_account', models.ForeignKey(null=True, on_delete=models.deletion.SET_NULL, related_name='mpesa_import_lines', to='finance_and_accounting.chartofaccount')),
            ],
            options={'ordering': ['-transaction_date', '-id']},
        ),
        migrations.CreateModel(
            name='ScheduledPaymentReminder',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reminder_type', models.CharField(choices=[('ar_due', 'AR Due'), ('ap_due', 'AP Due'), ('credit_follow_up', 'Credit Follow Up')], max_length=30)),
                ('entity_type', models.CharField(max_length=50)),
                ('entity_id', models.CharField(max_length=50)),
                ('recipient_email', models.EmailField(blank=True, default='', max_length=100)),
                ('due_date', models.DateField(blank=True, null=True)),
                ('amount_due', models.CharField(default='0.00', max_length=50)),
                ('sent', models.BooleanField(default=False)),
                ('sent_on', models.DateTimeField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('company_branch', models.ForeignKey(null=True, on_delete=models.deletion.CASCADE, related_name='payment_reminders', to='system_administration.companybranch')),
            ],
        ),
    ]
