# Generated by Django 5.1 on 2025-02-06 16:26

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='DataAccess',
            fields=[
                ('creation_date', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('last_update', models.DateTimeField(default=django.utils.timezone.now)),
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ('model_name', models.CharField(max_length=50)),
                ('model_id', models.UUIDField()),
                ('granted_at', models.DateTimeField(auto_now_add=True)),
                ('last_updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('related_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('shared_with', models.ManyToManyField(related_name='shared_data', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ModelLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('model_id', models.UUIDField()),
                ('operation', models.CharField(choices=[('POST', 'POST'), ('PUT', 'PUT'), ('DELETE', 'DELETE'), ('GRANT_ACCESS', 'GRANT_ACCESS'), ('REVOKE_ACCESS', 'REVOKE_ACCESS')], max_length=50)),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('model_name', models.CharField(max_length=50)),
                ('store_id', models.CharField(blank=True, max_length=200, null=True)),
                ('device_id', models.CharField(blank=True, max_length=200, null=True)),
                ('count', models.IntegerField(default=0)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='model_logs', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-date'],
                'indexes': [models.Index(fields=['date', 'user'], name='sync_modell_date_2bc081_idx'), models.Index(fields=['date', 'user', 'device_id'], name='sync_modell_date_77b4d0_idx')],
            },
        ),
    ]
