# Generated by Django 6.0.1 on 2026-01-28 10:03

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Device",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                (
                    "sn",
                    models.CharField(max_length=50, unique=True, verbose_name="SN码"),
                ),
                (
                    "mac_address",
                    models.CharField(
                        blank=True,
                        max_length=20,
                        null=True,
                        unique=True,
                        verbose_name="MAC地址",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=100,
                        verbose_name="自定义名称",
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("in_stock", "库存中"),
                            ("out_stock", "已出库"),
                            ("bound", "已绑定"),
                        ],
                        default="in_stock",
                        max_length=20,
                        verbose_name="状态",
                    ),
                ),
                (
                    "firmware_version",
                    models.CharField(
                        blank=True, default="", max_length=20, verbose_name="固件版本"
                    ),
                ),
                (
                    "last_online_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": "设备",
                "db_table": "device",
            },
        ),
        migrations.CreateModel(
            name="DeviceBatch",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("batch_no", models.CharField(max_length=50, verbose_name="批次号")),
                ("production_date", models.DateField(verbose_name="生产日期")),
                (
                    "production_week",
                    models.CharField(blank=True, max_length=10, verbose_name="生产周"),
                ),
                ("quantity", models.IntegerField(verbose_name="数量")),
                (
                    "remark",
                    models.TextField(blank=True, default="", verbose_name="备注"),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[("pending", "待生成"), ("generated", "已生成")],
                        default="pending",
                        max_length=20,
                        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": "device_batch",
            },
        ),
        migrations.CreateModel(
            name="DeviceType",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("brand", models.CharField(max_length=50, verbose_name="品牌")),
                (
                    "product_code",
                    models.CharField(
                        max_length=50, unique=True, verbose_name="产品代号"
                    ),
                ),
                ("name", models.CharField(max_length=100, verbose_name="名称")),
                (
                    "is_network_required",
                    models.BooleanField(default=True, verbose_name="是否需要联网"),
                ),
                (
                    "is_active",
                    models.BooleanField(default=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": "device_type",
            },
        ),
        migrations.CreateModel(
            name="UserDevice",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                (
                    "bind_type",
                    models.CharField(
                        choices=[("owner", "所有者"), ("share", "分享")],
                        default="owner",
                        max_length=20,
                        verbose_name="绑定类型",
                    ),
                ),
                (
                    "bind_time",
                    models.DateTimeField(auto_now_add=True, verbose_name="绑定时间"),
                ),
                (
                    "is_active",
                    models.BooleanField(default=True, verbose_name="是否有效"),
                ),
            ],
            options={
                "verbose_name": "用户设备绑定",
                "verbose_name_plural": "用户设备绑定",
                "db_table": "user_device",
            },
        ),
    ]
