# Generated by Django 5.2.10 on 2026-01-21 23:04

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


class Migration(migrations.Migration):

    dependencies = [
        ("repos", "0003_packagerepository"),
    ]

    operations = [
        migrations.CreateModel(
            name="GitHubEvent",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("received_at", models.DateTimeField(auto_now_add=True)),
                ("http_method", models.CharField(blank=True, max_length=10)),
                ("headers", models.JSONField(blank=True, default=dict)),
                ("query_params", models.JSONField(blank=True, default=dict)),
                ("payload", models.JSONField(blank=True, default=dict)),
                ("raw_body", models.TextField(blank=True)),
                ("owner", models.CharField(blank=True, max_length=255)),
                ("name", models.CharField(blank=True, max_length=255)),
                ("event_type", models.CharField(blank=True, max_length=255)),
                ("delivery_id", models.CharField(blank=True, max_length=255)),
                ("hook_id", models.CharField(blank=True, max_length=255)),
                ("signature", models.CharField(blank=True, max_length=255)),
                ("signature_256", models.CharField(blank=True, max_length=255)),
                ("user_agent", models.CharField(blank=True, max_length=255)),
                (
                    "repository",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="webhook_events",
                        to="repos.githubrepository",
                    ),
                ),
            ],
            options={
                "verbose_name": "GitHub Event",
                "verbose_name_plural": "GitHub Events",
                "ordering": ("-received_at",),
                "indexes": [
                    models.Index(fields=["event_type"], name="github_event_type_idx"),
                    models.Index(fields=["delivery_id"], name="github_delivery_id_idx"),
                ],
            },
        ),
    ]
