# Generated by Django 5.2.11 on 2026-04-25 08:04

import django.core.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('expat_life', '0025_foreignerprofile_is_furniture_cycle_active_and_more'),
        ('rental_app', '0009_rentalownerbankingdetails'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ServiceChangeRequest',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('profile_type', models.CharField(choices=[('foreigner', 'Foreigner')], default='foreigner', max_length=30)),
                ('request_type', models.CharField(choices=[('cancel_property_rental', 'Cancel Property Rental'), ('cancel_furniture_rental', 'Cancel Furniture Rental'), ('cancel_property_and_change', 'Cancel Property and Change'), ('cancel_furniture_and_change', 'Cancel Furniture and Change'), ('upgrade_lifestyle_package', 'Upgrade Lifestyle Package'), ('cancel_and_upgrade_package', 'Cancel and Upgrade Package'), ('other', 'Other')], max_length=50)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('reviewing', 'Reviewing'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='pending', max_length=20)),
                ('admin_approved', models.BooleanField(default=False)),
                ('user_reason', models.TextField(blank=True)),
                ('admin_notes', models.TextField(blank=True)),
                ('requested_at', models.DateTimeField(auto_now_add=True)),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_service_change_requests', to=settings.AUTH_USER_MODEL)),
                ('current_furniture_package', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='service_change_requests', to='expat_life.furniturepackage')),
                ('current_package', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='current_service_change_requests', to='expat_life.package')),
                ('current_property', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='service_change_requests', to='rental_app.rentallisting')),
                ('foreigner_profile', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='service_change_requests', to='expat_life.foreignerprofile')),
                ('requested_new_package', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='requested_service_change_requests', to='expat_life.package')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service_change_requests', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-requested_at'],
            },
        ),
        migrations.CreateModel(
            name='Payout',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('profile_type', models.CharField(choices=[('foreigner', 'Foreigner'), ('rental_owner', 'Rental Owner')], max_length=30)),
                ('payout_type', models.CharField(choices=[('foreign_refund', 'Foreigner Refund / Withdrawal'), ('rental_owner_income', 'Rental Owner Income Payout'), ('other', 'Other')], max_length=30)),
                ('amount_usd', models.DecimalField(decimal_places=2, default=0, max_digits=12, validators=[django.core.validators.MinValueValidator(0)])),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('approved', 'Approved'), ('processing', 'Processing'), ('paid', 'Paid'), ('rejected', 'Rejected'), ('cancelled', 'Cancelled')], default='pending', max_length=20)),
                ('requested_by_user', models.BooleanField(default=False)),
                ('approved_at', models.DateTimeField(blank=True, null=True)),
                ('paid_at', models.DateTimeField(blank=True, null=True)),
                ('reference_code', models.CharField(blank=True, db_index=True, max_length=120)),
                ('admin_notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('foreigner_profile', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payouts', to='expat_life.foreignerprofile')),
                ('related_payable_item', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payouts', to='expat_life.userpayableitem')),
                ('rental_owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payouts', to='rental_app.rentalowner')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payouts', to=settings.AUTH_USER_MODEL)),
                ('related_change_request', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payouts', to='expat_life.servicechangerequest')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ServiceChangeSettlementItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item_type', models.CharField(choices=[('damage', 'Damage Charge'), ('utility_bill', 'Utility Bill'), ('cleaning', 'Cleaning Fee'), ('late_charge', 'Late Charge'), ('refund_credit', 'Refund Credit'), ('other', 'Other')], max_length=30)),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('amount_usd', models.DecimalField(decimal_places=2, default=0, max_digits=12, validators=[django.core.validators.MinValueValidator(0)])),
                ('is_deduction', models.BooleanField(default=True, help_text='True for charges/deductions, False for refund credits.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('request', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='settlement_items', to='expat_life.servicechangerequest')),
            ],
            options={
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='WalletAccount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('profile_type', models.CharField(choices=[('foreigner', 'Foreigner'), ('dating_partner', 'Dating Partner'), ('service_partner', 'Service Partner'), ('rental_owner', 'Rental Owner')], max_length=30)),
                ('balance_usd', models.DecimalField(decimal_places=2, default=0, max_digits=12, validators=[django.core.validators.MinValueValidator(0)])),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wallet_accounts', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['profile_type'],
                'unique_together': {('user', 'profile_type')},
            },
        ),
        migrations.CreateModel(
            name='PayoutRequest',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('profile_type', models.CharField(choices=[('foreigner', 'Foreigner'), ('rental_owner', 'Rental Owner'), ('affiliate', 'Affiliate'), ('other', 'Other')], max_length=30)),
                ('request_type', models.CharField(choices=[('wallet_withdrawal', 'Wallet Withdrawal'), ('rental_owner_income', 'Rental Owner Income Withdrawal'), ('refund_withdrawal', 'Refund Withdrawal'), ('affiliate_commission', 'Affiliate Commission Withdrawal'), ('other', 'Other')], default='wallet_withdrawal', max_length=30)),
                ('amount_usd', models.DecimalField(decimal_places=2, default=0, max_digits=12, validators=[django.core.validators.MinValueValidator(0)])),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('reviewing', 'Reviewing'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('cancelled', 'Cancelled'), ('completed', 'Completed')], default='pending', max_length=20)),
                ('user_reason', models.TextField(blank=True)),
                ('admin_notes', models.TextField(blank=True)),
                ('admin_approved', models.BooleanField(default=False)),
                ('requested_at', models.DateTimeField(auto_now_add=True)),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('completed_at', models.DateTimeField(blank=True, null=True)),
                ('reference_code', models.CharField(blank=True, db_index=True, max_length=120)),
                ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_payout_requests', to=settings.AUTH_USER_MODEL)),
                ('related_payout', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='source_request', to='expat_life.payout')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payout_requests', to=settings.AUTH_USER_MODEL)),
                ('wallet', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payout_requests', to='expat_life.walletaccount')),
            ],
            options={
                'ordering': ['-requested_at'],
            },
        ),
        migrations.AddField(
            model_name='payout',
            name='wallet',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payouts', to='expat_life.walletaccount'),
        ),
        migrations.CreateModel(
            name='WalletTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_type', models.CharField(choices=[('topup', 'Top-up'), ('refund', 'Refund'), ('deduction', 'Deduction'), ('payment', 'Wallet Payment'), ('manual_credit', 'Manual Credit'), ('manual_debit', 'Manual Debit'), ('payout_hold', 'Payout Hold'), ('payout_release', 'Payout Release'), ('other', 'Other')], max_length=30)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('completed', 'Completed'), ('cancelled', 'Cancelled'), ('failed', 'Failed')], default='completed', max_length=20)),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('amount_usd', models.DecimalField(decimal_places=2, default=0, max_digits=12, validators=[django.core.validators.MinValueValidator(0)])),
                ('is_credit', models.BooleanField(default=True, help_text='True adds to wallet, False deducts from wallet.')),
                ('reference_code', models.CharField(blank=True, db_index=True, max_length=120)),
                ('admin_notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('related_change_request', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='wallet_transactions', to='expat_life.servicechangerequest')),
                ('related_payable_item', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='wallet_transactions', to='expat_life.userpayableitem')),
                ('wallet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='expat_life.walletaccount')),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
    ]
