# Generated by Django 5.1.7 on 2025-04-01 09:47

import card.storage
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Card",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "unique_id",
                    models.CharField(
                        max_length=100, unique=True, verbose_name="唯一标识"
                    ),
                ),
                ("name", models.CharField(max_length=100, verbose_name="名称")),
                ("description", models.TextField(blank=True, verbose_name="描述")),
                (
                    "image",
                    models.ImageField(
                        blank=True,
                        null=True,
                        storage=card.storage.OSSStorage(base_dir="cards"),
                        upload_to="images/",
                        verbose_name="Image",
                    ),
                ),
                (
                    "price",
                    models.DecimalField(
                        decimal_places=2, default=0, max_digits=10, verbose_name="价格"
                    ),
                ),
                (
                    "quantity",
                    models.PositiveIntegerField(default=1, verbose_name="Quantity"),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("active", "可用"),
                            ("used", "已使用"),
                            ("void", "已作废"),
                            ("inactive", "未激活"),
                        ],
                        default="inactive",
                        max_length=20,
                        verbose_name="状态",
                    ),
                ),
                (
                    "used_at",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="使用时间"
                    ),
                ),
                (
                    "manufactured",
                    models.BooleanField(default=False, verbose_name="已生产"),
                ),
                (
                    "manufactured_at",
                    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": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="CardBatch",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "batch_number",
                    models.CharField(max_length=50, unique=True, verbose_name="批次号"),
                ),
                ("quantity", models.PositiveIntegerField(verbose_name="数量")),
                ("description", models.TextField(blank=True, verbose_name="描述")),
                ("exported", models.BooleanField(default=False, verbose_name="已导出")),
                (
                    "exported_at",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="导出时间"
                    ),
                ),
                (
                    "excel_file",
                    models.FileField(
                        blank=True,
                        null=True,
                        upload_to="card_batches/",
                        verbose_name="Excel文件",
                    ),
                ),
                (
                    "sent_to_production",
                    models.BooleanField(default=False, verbose_name="已发送生产"),
                ),
                (
                    "production_date",
                    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": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="CardCategory",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        choices=[
                            ("clothing", "Clothing"),
                            ("prop", "Prop"),
                            ("song", "Song"),
                            ("dance", "Dance"),
                            ("furniture", "Furniture"),
                            ("decoration", "Decoration"),
                        ],
                        max_length=50,
                        unique=True,
                        verbose_name="类别名称",
                    ),
                ),
                ("description", 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": "卡片类别",
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="CardUsageLog",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "action",
                    models.CharField(
                        choices=[("scan", "扫描"), ("use", "使用"), ("void", "作废")],
                        max_length=20,
                        verbose_name="操作",
                    ),
                ),
                ("details", models.TextField(blank=True, verbose_name="详细信息")),
                ("old_status", models.CharField(max_length=20, verbose_name="原状态")),
                ("new_status", models.CharField(max_length=20, verbose_name="新状态")),
                (
                    "ip_address",
                    models.GenericIPAddressField(
                        blank=True, null=True, verbose_name="IP地址"
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
            ],
            options={
                "verbose_name": "使用记录",
                "verbose_name_plural": "使用记录",
                "ordering": ["-created_at"],
            },
        ),
    ]
