from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("base", "0006_oneclickunsubscribeaudit_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="MailSmtpSettings",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("smtp_relay_host", models.CharField(blank=True, max_length=255)),
                ("smtp_relay_port", models.PositiveIntegerField(default=587)),
                ("smtp_use_tls", models.BooleanField(default=True)),
                (
                    "smtp_use_ssl",
                    models.BooleanField(default=False, help_text="465 常用 SSL（Implicit TLS）；587 常用 STARTTLS（TLS）。"),
                ),
                ("smtp_timeout_seconds", models.PositiveIntegerField(default=15)),
                ("smtp_username", models.CharField(blank=True, max_length=255)),
                ("smtp_password", models.TextField(blank=True)),
            ],
            options={
                "verbose_name": "SMTP Settings",
            },
        ),
        migrations.CreateModel(
            name="SystemNotificationMailSettings",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("contact_form_from_name", models.CharField(blank=True, max_length=255)),
                ("contact_form_from_email", models.EmailField(blank=True, max_length=254)),
                ("contact_form_reply_to_email", models.EmailField(blank=True, max_length=254)),
                ("contact_form_to_emails", models.TextField(blank=True, help_text="可填多個收件人，以逗號或換行分隔。")),
                ("contact_form_subject_prefix", models.CharField(blank=True, default="[Contact Us]", max_length=255)),
                ("contact_form_user_subject_template", models.CharField(blank=True, default="已收到您的聯絡表單", max_length=255)),
                (
                    "contact_form_user_text_template",
                    models.TextField(
                        blank=True,
                        default="您好 {{name}}：\n\n我們已收到您的來信：\nEmail: {{email}}\n聯絡方式: {{contact}}\n問題類別: {{category}}\n\n留言內容:\n{{message}}\n\n我們會儘快與您聯繫",
                    ),
                ),
                (
                    "contact_form_user_html_template",
                    models.TextField(
                        blank=True,
                        default="<p>您好 {{name}}：</p><p>我們已收到您的來信：</p><ul><li>Email: {{email}}</li><li>聯絡方式: {{contact}}</li><li>問題類別: {{category}}</li></ul><p>留言內容：</p><p>{{message}}</p><p>我們會儘快與您聯繫</p>",
                    ),
                ),
                ("default_charset", models.CharField(default="utf-8", max_length=50)),
            ],
            options={
                "verbose_name": "System Notification Mail Settings",
            },
        ),
        migrations.CreateModel(
            name="ContactFormSubmission",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=100)),
                ("email", models.EmailField(blank=True, max_length=254)),
                ("contact", models.CharField(max_length=255)),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("collaboration", "合作邀約"),
                            ("website_issue", "網站問題回報"),
                            ("career", "求職專區"),
                            ("other", "其他"),
                        ],
                        max_length=32,
                    ),
                ),
                ("message", models.TextField()),
                ("source_page", models.CharField(blank=True, max_length=512)),
                ("ip_address", models.GenericIPAddressField(blank=True, null=True)),
                ("user_agent", models.TextField(blank=True)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
            ],
            options={
                "ordering": ["-created_at"],
            },
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_password",
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_relay_host",
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_relay_port",
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_timeout_seconds",
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_use_ssl",
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_use_tls",
        ),
        migrations.RemoveField(
            model_name="newslettersystemsettings",
            name="smtp_username",
        ),
    ]
