# Generated by Django 6.0.1 on 2026-03-04 04:57

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('shop', '__first__'),
    ]

    operations = [
        migrations.CreateModel(
            name='Announcement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='公告标题')),
                ('content', models.TextField(verbose_name='公告内容')),
                ('image', models.ImageField(blank=True, null=True, upload_to='announcements/', verbose_name='公告图片')),
                ('image_url', models.URLField(blank=True, help_text='优先使用上传的图片', null=True, verbose_name='图片链接')),
                ('link_url', models.URLField(blank=True, null=True, verbose_name='跳转链接')),
                ('is_active', models.BooleanField(default=True, verbose_name='是否启用')),
                ('is_pinned', models.BooleanField(default=False, verbose_name='是否置顶')),
                ('priority', models.IntegerField(default=0, help_text='数字越大越靠前', verbose_name='排序权重')),
                ('start_time', models.DateTimeField(blank=True, null=True, verbose_name='开始展示时间')),
                ('end_time', models.DateTimeField(blank=True, null=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': '社区公告管理',
                'ordering': ['-is_pinned', '-priority', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='Activity',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='活动标题')),
                ('description', models.TextField(verbose_name='活动详情')),
                ('banner', models.ImageField(blank=True, null=True, upload_to='activities/banners/', verbose_name='活动Banner图')),
                ('banner_url', models.URLField(blank=True, help_text='可直接填写图片链接，若同时上传图片，将优先显示上传的图片', null=True, verbose_name='活动Banner链接')),
                ('start_time', models.DateTimeField(verbose_name='开始时间')),
                ('end_time', models.DateTimeField(verbose_name='结束时间')),
                ('location', models.CharField(max_length=100, verbose_name='活动地点')),
                ('max_participants', models.IntegerField(default=50, verbose_name='最大报名人数')),
                ('is_paid', models.BooleanField(default=False, verbose_name='是否收费')),
                ('price', models.DecimalField(decimal_places=2, default=0, max_digits=10, verbose_name='报名费用')),
                ('is_active', models.BooleanField(default=True, verbose_name='是否启用')),
                ('is_visible', models.BooleanField(default=True, help_text='关闭后将不在前端列表页显示', verbose_name='是否显示')),
                ('auto_confirm', models.BooleanField(default=False, help_text='开启后，付费活动支付成功或免费活动报名后直接显示报名成功，不需要审核', verbose_name='无需审核')),
                ('ask_name', models.BooleanField(default=False, verbose_name='收集姓名')),
                ('ask_phone', models.BooleanField(default=False, verbose_name='收集手机号')),
                ('ask_wechat', models.BooleanField(default=False, verbose_name='收集微信号')),
                ('ask_company', models.BooleanField(default=False, verbose_name='收集公司/机构')),
                ('signup_form_config', models.JSONField(blank=True, default=list, help_text='JSON格式的高级配置，若填写则优先于上方开关。例如：[{"name": "job", "label": "职位", "type": "text", "required": true}]', verbose_name='自定义报名配置')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
            ],
            options={
                'verbose_name': '社区活动',
                'verbose_name_plural': '社区活动管理',
            },
        ),
        migrations.CreateModel(
            name='Topic',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200, verbose_name='标题')),
                ('category', models.CharField(choices=[('discussion', '技术讨论'), ('help', '求助问答'), ('share', '经验分享'), ('notice', '官方公告')], default='discussion', max_length=20, verbose_name='分类')),
                ('status', models.CharField(choices=[('pending', '待审核'), ('published', '已发布'), ('rejected', '已拒绝')], default='published', max_length=20, verbose_name='状态')),
                ('content', models.TextField(help_text='支持Markdown格式，支持插入图片', verbose_name='内容')),
                ('view_count', models.IntegerField(default=0, verbose_name='浏览量')),
                ('is_pinned', models.BooleanField(default=False, verbose_name='置顶')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='发布时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('order', models.IntegerField(default=0, verbose_name='排序')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topics', to='shop.wechatuser', verbose_name='作者')),
                ('likes', models.ManyToManyField(blank=True, related_name='liked_topics', to='shop.wechatuser', verbose_name='点赞用户')),
                ('related_course', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='shop.vccourse', verbose_name='关联课程')),
                ('related_product', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='shop.esp32config', verbose_name='关联硬件')),
                ('related_service', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='shop.service', verbose_name='关联服务')),
            ],
            options={
                'verbose_name': '论坛帖子',
                'verbose_name_plural': '论坛帖子管理',
                'ordering': ['order', '-is_pinned', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='Reply',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField(help_text='支持Markdown格式', verbose_name='回复内容')),
                ('is_pinned', models.BooleanField(default=False, verbose_name='置顶')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='回复时间')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='replies', to='shop.wechatuser', verbose_name='回复者')),
                ('likes', models.ManyToManyField(blank=True, related_name='liked_replies', to='shop.wechatuser', verbose_name='点赞用户')),
                ('reply_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='community.reply', verbose_name='回复楼层')),
                ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='replies', to='community.topic', verbose_name='所属帖子')),
            ],
            options={
                'verbose_name': '帖子回复',
                'verbose_name_plural': '帖子回复管理',
                'ordering': ['-is_pinned', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='TopicMedia',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(blank=True, null=True, upload_to='community/media/', verbose_name='文件')),
                ('file_url', models.URLField(blank=True, max_length=500, null=True, verbose_name='文件链接')),
                ('media_type', models.CharField(choices=[('image', '图片'), ('video', '视频'), ('file', '文件')], default='image', max_length=10, verbose_name='媒体类型')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='上传时间')),
                ('reply', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='media', to='community.reply', verbose_name='所属回复')),
                ('topic', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='media', to='community.topic', verbose_name='所属帖子')),
            ],
            options={
                'verbose_name': '论坛媒体资源',
                'verbose_name_plural': '论坛媒体资源管理',
            },
        ),
        migrations.CreateModel(
            name='ActivitySignup',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('signup_time', models.DateTimeField(auto_now_add=True, verbose_name='报名时间')),
                ('signup_info', models.JSONField(blank=True, default=dict, verbose_name='报名信息')),
                ('status', models.CharField(choices=[('unpaid', '待支付'), ('pending', '审核中'), ('confirmed', '报名成功'), ('cancelled', '已取消')], default='confirmed', max_length=20, verbose_name='状态')),
                ('activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='signups', to='community.activity', verbose_name='活动')),
                ('order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='activity_signups', to='shop.order', verbose_name='关联订单')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activity_signups', to='shop.wechatuser', verbose_name='报名用户')),
            ],
            options={
                'verbose_name': '活动报名',
                'verbose_name_plural': '活动报名管理',
                'unique_together': {('activity', 'user')},
            },
        ),
    ]
