# Generated by Django 6.0.1 on 2026-02-27 06:23

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


class Migration(migrations.Migration):

    dependencies = [
        ('devices', '0003_device_battery_device_icon_device_is_ai_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='devicetype',
            name='default_prompt',
            field=models.TextField(blank=True, default='', verbose_name='默认提示词模板'),
        ),
        migrations.AddField(
            model_name='devicetype',
            name='default_voice_id',
            field=models.CharField(blank=True, default='', max_length=100, verbose_name='默认音色ID'),
        ),
        migrations.CreateModel(
            name='RoleMemory',
            fields=[
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('is_bound', models.BooleanField(default=True, verbose_name='是否已绑定设备')),
                ('nickname', models.CharField(blank=True, default='', max_length=50, verbose_name='设备昵称')),
                ('user_name', models.CharField(blank=True, default='', max_length=50, verbose_name='用户称呼')),
                ('volume', models.IntegerField(default=50, verbose_name='音量')),
                ('brightness', models.IntegerField(default=50, verbose_name='亮度')),
                ('allow_interrupt', models.BooleanField(default=True, verbose_name='允许打断')),
                ('privacy_mode', models.BooleanField(default=False, verbose_name='隐私模式')),
                ('prompt', models.TextField(blank=True, default='', verbose_name='提示词')),
                ('voice_id', models.CharField(blank=True, default='', max_length=100, verbose_name='音色ID')),
                ('memory_summary', models.TextField(blank=True, default='', verbose_name='聊天记忆摘要')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('device_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='role_memories', to='devices.devicetype', verbose_name='设备类型')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_memories', to=settings.AUTH_USER_MODEL, verbose_name='用户')),
            ],
            options={
                'verbose_name': '角色记忆',
                'verbose_name_plural': '角色记忆',
                'db_table': 'role_memory',
            },
        ),
        migrations.AddField(
            model_name='userdevice',
            name='role_memory',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='user_devices', to='devices.rolememory', verbose_name='角色记忆'),
        ),
        migrations.AddIndex(
            model_name='rolememory',
            index=models.Index(fields=['user', 'device_type'], name='role_memory_user_id_c7dd09_idx'),
        ),
        migrations.AddIndex(
            model_name='rolememory',
            index=models.Index(fields=['is_bound'], name='role_memory_is_boun_556b2c_idx'),
        ),
    ]
