# Generated by Django 5.2.4 on 2025-07-21 16:28

import django.db.models.deletion
import djangouseragents.models.user_agent_device
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='UserAgentDevice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, default=djangouseragents.models.user_agent_device.get_unique_name, editable=False, help_text='A unique name is assigned to each agent completely randomly so that each agent can be called by the same name.', max_length=255, unique=True, verbose_name='Name')),
                ('key', models.CharField(blank=True, db_index=True, max_length=255, null=True, unique=True, verbose_name='Key')),
                ('user_id', models.CharField(blank=True, max_length=255, null=True, verbose_name='User ID')),
                ('is_mobile', models.BooleanField(blank=True, null=True, verbose_name='Mobile')),
                ('is_tablet', models.BooleanField(blank=True, null=True, verbose_name='Tablet')),
                ('is_touch_capable', models.BooleanField(blank=True, null=True, verbose_name='Touch Capable')),
                ('is_pc', models.BooleanField(blank=True, null=True, verbose_name='PC')),
                ('is_bot', models.BooleanField(blank=True, null=True, verbose_name='Bot')),
                ('browser_family', models.CharField(blank=True, max_length=255, null=True, verbose_name='Browser Family')),
                ('browser_version', models.CharField(blank=True, max_length=255, null=True, verbose_name='Browser Version')),
                ('os_family', models.CharField(blank=True, max_length=255, null=True, verbose_name='OS Family')),
                ('os_version', models.CharField(blank=True, max_length=255, null=True, verbose_name='OS Version')),
                ('device_family', models.CharField(blank=True, max_length=255, null=True, verbose_name='Device Family')),
                ('device_brand', models.CharField(blank=True, max_length=255, null=True, verbose_name='Device Brand')),
                ('device_model', models.CharField(blank=True, max_length=255, null=True, verbose_name='Device Model')),
                ('ip', models.CharField(blank=True, max_length=255, null=True, verbose_name='IP')),
                ('created_dt', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='First Visit DateTime')),
            ],
            options={
                'verbose_name': 'User Agent Device',
                'verbose_name_plural': 'User Agent Devices',
            },
        ),
        migrations.CreateModel(
            name='UserAgentRequest',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('endpoint', models.TextField(verbose_name='Endpoint')),
                ('response_status_code', models.IntegerField(verbose_name='Response Status Code')),
                ('rn', models.IntegerField(default=0, help_text='Total request count', verbose_name='Request Number')),
                ('rn_ph', models.IntegerField(default=0, help_text='Last 1 hour', verbose_name='Requests Per Hour')),
                ('rn_24h', models.IntegerField(default=0, help_text='Last 24 hours', verbose_name='Requests Last 24h')),
                ('status_color', models.CharField(default='#06d6a0', max_length=255, verbose_name='Status Color')),
                ('status', models.CharField(choices=[('Normal', 'Normal'), ('Busy', 'Busy'), ('Very Busy', 'Very Busy'), ('Abnormal', 'Abnormal')], default='Normal', max_length=64, verbose_name='Status')),
                ('method', models.CharField(blank=True, max_length=64, null=True, verbose_name='HTTP Method')),
                ('get', models.JSONField(blank=True, null=True, verbose_name='GET')),
                ('headers', models.JSONField(blank=True, null=True, verbose_name='Headers')),
                ('cookies', models.JSONField(blank=True, null=True, verbose_name='Cookies')),
                ('created_dt', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Created Datetime')),
                ('uad', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='requests', to='djangouseragents.useragentdevice', verbose_name='User Agent Device')),
            ],
            options={
                'verbose_name': 'User Agent Request',
                'verbose_name_plural': 'User Agent Requests',
                'indexes': [models.Index(fields=['uad', 'created_dt'], name='djangousera_uad_id_2cd160_idx')],
            },
        ),
    ]
