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


class Migration(migrations.Migration):
    initial = True
    dependencies = [
        ("accounts", "0001_initial"),
    ]
    operations = [
        migrations.CreateModel(
            name="Source",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=200)),
                (
                    "kind",
                    models.CharField(
                        choices=[
                            ("slack_channel", "Slack channel"),
                            ("discord_channel", "Discord channel"),
                            ("github_repo", "GitHub repo"),
                            ("discourse_category", "Discourse category"),
                            ("twitter_stream", "Twitter/X stream"),
                        ],
                        max_length=50,
                    ),
                ),
                ("external_id", models.CharField(max_length=255)),
                ("metadata", models.JSONField(blank=True, default=dict)),
                (
                    "workspace",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="sources", to="accounts.workspace"
                    ),
                ),
            ],
            options={
                "unique_together": {("kind", "external_id")},
            },
        ),
    ]
