# Generated by Django 5.1.5 on 2025-04-09 15:16

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


class Migration(migrations.Migration):

    dependencies = [
        ('user_management', '0004_knowledgebasedocument'),
    ]

    operations = [
        migrations.CreateModel(
            name='GmailAttachment',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('gmail_message_id', models.CharField(max_length=100, verbose_name='Gmail消息ID')),
                ('filename', models.CharField(max_length=255, verbose_name='文件名')),
                ('filepath', models.CharField(max_length=500, verbose_name='文件路径')),
                ('mimetype', models.CharField(max_length=100, verbose_name='MIME类型')),
                ('filesize', models.IntegerField(default=0, verbose_name='文件大小')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('chat_message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='gmail_attachments', to='user_management.chathistory')),
            ],
            options={
                'verbose_name': 'Gmail附件',
                'verbose_name_plural': 'Gmail附件',
                'db_table': 'gmail_attachments',
            },
        ),
        migrations.CreateModel(
            name='GmailCredential',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('token_path', models.CharField(max_length=255, verbose_name='Token存储路径')),
                ('last_history_id', models.CharField(blank=True, max_length=100, null=True, verbose_name='上次同步历史ID')),
                ('watch_expiration', models.DateTimeField(blank=True, null=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='更新时间')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='gmail_credentials', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Gmail认证凭据',
                'verbose_name_plural': 'Gmail认证凭据',
                'db_table': 'gmail_credentials',
            },
        ),
        migrations.CreateModel(
            name='GmailTalentMapping',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('talent_email', models.EmailField(max_length=254, verbose_name='达人邮箱')),
                ('conversation_id', models.CharField(max_length=100, verbose_name='对话ID')),
                ('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='更新时间')),
                ('knowledge_base', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='gmail_mappings', to='user_management.knowledgebase')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='gmail_talent_mappings', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Gmail达人映射',
                'verbose_name_plural': 'Gmail达人映射',
                'db_table': 'gmail_talent_mappings',
                'unique_together': {('user', 'talent_email')},
            },
        ),
    ]
