# Generated by Django 5.2.5 on 2025-10-09 10:12

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


class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='VideoMetadata',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sensitive_frame_count', models.IntegerField(blank=True, help_text='Number of frames detected as containing sensitive information', null=True)),
                ('sensitive_ratio', models.FloatField(blank=True, help_text='Ratio of sensitive frames to total frames (0.0-1.0)', null=True)),
                ('sensitive_frame_ids', models.TextField(blank=True, help_text='JSON array of sensitive frame indices (0-based)', null=True)),
                ('analyzed_at', models.DateTimeField(auto_now=True, help_text='Timestamp of last analysis')),
                ('video', models.OneToOneField(help_text='Video file this metadata belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='metadata', to='endoreg_db.videofile')),
            ],
            options={
                'verbose_name': 'Video Metadata',
                'verbose_name_plural': 'Video Metadata',
                'db_table': 'video_metadata',
            },
        ),
        migrations.CreateModel(
            name='VideoProcessingHistory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('operation', models.CharField(choices=[('mask_overlay', 'Mask Overlay'), ('frame_removal', 'Frame Removal'), ('analysis', 'Sensitivity Analysis'), ('reprocessing', 'Full Reprocessing')], help_text='Type of processing operation', max_length=50)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('success', 'Success'), ('failure', 'Failure'), ('cancelled', 'Cancelled')], default='pending', help_text='Current status of the operation', max_length=20)),
                ('config', models.JSONField(default=dict, help_text='Operation configuration (mask settings, frame list, etc.)')),
                ('output_file', models.CharField(blank=True, help_text='Path to output file (relative to MEDIA_ROOT)', max_length=500)),
                ('details', models.TextField(blank=True, help_text='Additional details or error messages')),
                ('task_id', models.CharField(blank=True, help_text='Celery task ID for progress tracking', max_length=100)),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='When the operation was started')),
                ('completed_at', models.DateTimeField(blank=True, help_text='When the operation completed (success or failure)', null=True)),
                ('video', models.ForeignKey(help_text='Video file this operation was performed on', on_delete=django.db.models.deletion.CASCADE, related_name='processing_history', to='endoreg_db.videofile')),
            ],
            options={
                'verbose_name': 'Video Processing History',
                'verbose_name_plural': 'Video Processing Histories',
                'db_table': 'video_processing_history',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['video', '-created_at'], name='video_proce_video_i_98ffe0_idx'), models.Index(fields=['task_id'], name='video_proce_task_id_ec8b15_idx'), models.Index(fields=['status'], name='video_proce_status_6f71fd_idx')],
            },
        ),
    ]
