# Generated by Django 5.2.5 on 2025-08-08 01:42

import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='TelegramBot',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Произвольное имя бота в проекте', max_length=100)),
                ('username', models.CharField(blank=True, help_text='@username в Telegram', max_length=100)),
                ('token', models.CharField(max_length=200)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='TelegramChat',
            fields=[
                ('id', models.BigIntegerField(primary_key=True, serialize=False)),
                ('type', models.CharField(choices=[('private', 'private'), ('group', 'group'), ('supergroup', 'supergroup'), ('channel', 'channel')], max_length=20)),
                ('title', models.CharField(blank=True, default='', max_length=255)),
                ('username', models.CharField(blank=True, default='', max_length=255)),
                ('is_member', models.BooleanField(default=True)),
                ('joined_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('left_at', models.DateTimeField(blank=True, null=True)),
                ('last_message_at', models.DateTimeField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Telegram чат',
                'verbose_name_plural': 'Telegram чаты',
            },
        ),
        migrations.CreateModel(
            name='BotConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('parse_mode', models.CharField(choices=[('HTML', 'HTML'), ('MarkdownV2', 'MarkdownV2'), ('None', 'None')], default='HTML', max_length=20)),
                ('allowed_updates', models.JSONField(blank=True, default=list)),
                ('admin_user_ids', models.JSONField(blank=True, default=list, help_text='Список Telegram user_id админов')),
                ('webhook_url', models.URLField(blank=True, default='', help_text='Если используете вебхуки')),
                ('use_webhook', models.BooleanField(default=False)),
                ('bot', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='config', to='bot.telegrambot')),
            ],
        ),
    ]
