# Generated by Django 5.2.3 on 2025-06-23 02:14

import common.encoder.encoder
import django.contrib.postgres.fields
import django.db.models.deletion
import uuid
import uuid_utils.compat
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('users', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Log',
            fields=[
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('id', models.UUIDField(default=uuid_utils.compat.uuid7, editable=False, primary_key=True, serialize=False, verbose_name='主键id')),
                ('menu', models.CharField(max_length=128, verbose_name='操作菜单')),
                ('operate', models.CharField(max_length=128, verbose_name='操作')),
                ('operation_object', models.JSONField(default=dict, encoder=common.encoder.encoder.SystemEncoder, verbose_name='操作对象')),
                ('user', models.JSONField(default=dict, verbose_name='用户信息')),
                ('status', models.IntegerField(verbose_name='状态')),
                ('ip_address', models.CharField(max_length=128, verbose_name='ip地址')),
                ('details', models.JSONField(default=dict, encoder=common.encoder.encoder.SystemEncoder, verbose_name='详情')),
                ('workspace_id', models.CharField(db_index=True, default='default', max_length=64, verbose_name='工作空间id')),
            ],
            options={
                'db_table': 'log',
            },
        ),
        migrations.CreateModel(
            name='SystemSetting',
            fields=[
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('type', models.IntegerField(choices=[(0, '邮箱'), (1, '私钥秘钥')], default=0, primary_key=True, serialize=False, verbose_name='设置类型')),
                ('meta', models.JSONField(default=dict, verbose_name='配置数据')),
            ],
            options={
                'db_table': 'system_setting',
            },
        ),
        migrations.CreateModel(
            name='WorkspaceUserResourcePermission',
            fields=[
                ('id', models.UUIDField(default=uuid_utils.compat.uuid7, editable=False, primary_key=True, serialize=False, verbose_name='主键id')),
                ('workspace_id', models.CharField(default='default', max_length=128, verbose_name='工作空间id')),
                ('auth_target_type', models.CharField(choices=[('KNOWLEDGE', '知识库'), ('APPLICATION', '应用')], default='KNOWLEDGE', max_length=128, verbose_name='授权目标')),
                ('target', models.UUIDField(verbose_name='知识库/应用id')),
                ('auth_type', models.CharField(choices=[('ROLE', 'Role'), ('RESOURCE_PERMISSION_GROUP', 'Resource Permission Group')], db_default='ROLE', default=False, verbose_name='授权类型')),
                ('permission_list', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, choices=[('VIEW', 'View'), ('MANAGE', 'Manage'), ('ROLE', 'Role')], default='VIEW', max_length=256), default=list, size=None, verbose_name='权限列表')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='users.user', verbose_name='工作空间下的用户')),
            ],
            options={
                'db_table': 'workspace_user_resource_permission',
            },
        ),
    ]
