# Generated by Django 5.2.9 on 2026-01-05 00:08

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


class Migration(migrations.Migration):

    dependencies = [
        ("account", "0010_transactionmodel_cost_variance_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="SystemSettingsModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "require_user_approval",
                    models.BooleanField(
                        default=True,
                        help_text="关闭后新用户注册将自动批准",
                        verbose_name="需要管理员审批新用户",
                    ),
                ),
                (
                    "auto_approve_first_admin",
                    models.BooleanField(
                        default=True,
                        help_text="系统无管理员时，首个注册的用户自动成为管理员并获得批准",
                        verbose_name="自动批准首个管理员用户",
                    ),
                ),
                (
                    "user_agreement_content",
                    models.TextField(
                        blank=True,
                        help_text="用户注册时需要同意的协议内容，支持HTML",
                        verbose_name="用户协议内容",
                    ),
                ),
                (
                    "risk_warning_content",
                    models.TextField(
                        blank=True,
                        help_text="用户注册时需要确认的风险提示内容，支持HTML",
                        verbose_name="风险提示内容",
                    ),
                ),
                ("notes", models.TextField(blank=True, verbose_name="备注")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "系统配置",
                "verbose_name_plural": "系统配置",
                "db_table": "system_settings",
            },
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="agreement_accepted_at",
            field=models.DateTimeField(blank=True, null=True, verbose_name="协议接受时间"),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="agreement_ip_address",
            field=models.GenericIPAddressField(blank=True, null=True, verbose_name="协议接受IP"),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="approval_status",
            field=models.CharField(
                choices=[
                    ("pending", "待审批"),
                    ("approved", "已批准"),
                    ("rejected", "已拒绝"),
                    ("auto_approved", "自动批准"),
                ],
                default="pending",
                max_length=20,
                verbose_name="审批状态",
            ),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="approved_at",
            field=models.DateTimeField(blank=True, null=True, verbose_name="批准时间"),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="approved_by",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="approved_users",
                to=settings.AUTH_USER_MODEL,
                verbose_name="审批人",
            ),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="rejection_reason",
            field=models.TextField(blank=True, verbose_name="拒绝原因"),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="risk_warning_acknowledged",
            field=models.BooleanField(default=False, verbose_name="风险提示已确认"),
        ),
        migrations.AddField(
            model_name="accountprofilemodel",
            name="user_agreement_accepted",
            field=models.BooleanField(default=False, verbose_name="用户协议已接受"),
        ),
    ]
