# Generated by Django 5.2.4 on 2025-07-20 04:14

import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='GeneratedReport',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('report_type', models.CharField(max_length=50)),
                ('report_name', models.CharField(max_length=200)),
                ('format', models.CharField(choices=[('pdf', 'PDF'), ('excel', 'Excel'), ('csv', 'CSV')], max_length=10)),
                ('file_path', models.FileField(upload_to='generated_reports/')),
                ('file_size', models.PositiveIntegerField(blank=True, null=True)),
                ('parameters', models.JSONField(blank=True, null=True)),
                ('generated_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'generated_reports',
                'ordering': ['-generated_at'],
            },
        ),
        migrations.CreateModel(
            name='LoanScoring',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('repayment_history_score', models.PositiveIntegerField(default=0)),
                ('income_score', models.PositiveIntegerField(default=0)),
                ('rollover_frequency_score', models.PositiveIntegerField(default=0)),
                ('employment_stability_score', models.PositiveIntegerField(default=0)),
                ('total_score', models.PositiveIntegerField(default=0)),
                ('credit_limit', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
                ('is_eligible', models.BooleanField(default=True)),
                ('risk_level', models.CharField(choices=[('low', 'Low Risk'), ('medium', 'Medium Risk'), ('high', 'High Risk')], default='medium', max_length=20)),
                ('calculated_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'loan_scoring',
                'ordering': ['-calculated_at'],
            },
        ),
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('notification_type', models.CharField(choices=[('application_status', 'Application Status'), ('payment_reminder', 'Payment Reminder'), ('overdue_alert', 'Overdue Alert'), ('welcome', 'Welcome Message'), ('loan_approved', 'Loan Approved'), ('loan_rejected', 'Loan Rejected'), ('payment_received', 'Payment Received'), ('rollover_approved', 'Rollover Approved'), ('rollover_rejected', 'Rollover Rejected')], max_length=30)),
                ('title', models.CharField(max_length=200)),
                ('message', models.TextField()),
                ('channel', models.CharField(choices=[('email', 'Email'), ('sms', 'SMS'), ('push', 'Push Notification'), ('in_app', 'In-App')], max_length=20)),
                ('is_sent', models.BooleanField(default=False)),
                ('sent_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'notifications',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ReportTemplate',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=200)),
                ('report_type', models.CharField(choices=[('borrower_report', 'Borrower Report'), ('loan_report', 'Loan Report'), ('collection_report', 'Collection Report'), ('default_report', 'Default Report'), ('rollover_report', 'Rollover Report')], max_length=30)),
                ('description', models.TextField(blank=True, null=True)),
                ('template_file', models.FileField(blank=True, null=True, upload_to='report_templates/')),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'report_templates',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='SystemSettings',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('default_interest_rate', models.DecimalField(decimal_places=2, default=24.0, max_digits=5)),
                ('default_processing_fee', models.DecimalField(decimal_places=2, default=5.0, max_digits=5)),
                ('default_late_penalty', models.DecimalField(decimal_places=2, default=5.0, max_digits=5)),
                ('rollover_fee_percentage', models.DecimalField(decimal_places=2, default=10.0, max_digits=5)),
                ('max_rollover_days', models.PositiveIntegerField(default=30)),
                ('max_rollover_count', models.PositiveIntegerField(default=3)),
                ('auto_approval_enabled', models.BooleanField(default=True)),
                ('auto_approval_min_score', models.PositiveIntegerField(default=60)),
                ('auto_approval_max_amount', models.DecimalField(decimal_places=2, default=50000, max_digits=12)),
                ('email_notifications_enabled', models.BooleanField(default=True)),
                ('sms_notifications_enabled', models.BooleanField(default=True)),
                ('mpesa_business_shortcode', models.CharField(blank=True, max_length=10, null=True)),
                ('mpesa_passkey', models.CharField(blank=True, max_length=100, null=True)),
                ('mpesa_environment', models.CharField(choices=[('sandbox', 'Sandbox'), ('production', 'Production')], default='sandbox', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'System Setting',
                'verbose_name_plural': 'System Settings',
                'db_table': 'system_settings',
            },
        ),
    ]
