# Generated by Django 4.2.7 on 2023-12-04 10:53

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


class Migration(migrations.Migration):
    replaces = [
        ("jira_app", "0001_initial"),
        ("jira_app", "0002_alter_jirauser_user"),
        ("jira_app", "0003_jiraissue"),
        ("jira_app", "0004_alter_jiraissue_assignee_alter_jiraissue_reporter_and_more"),
        ("jira_app", "0005_alter_jiraissue_assignee"),
    ]

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

    operations = [
        migrations.CreateModel(
            name="JiraUser",
            fields=[
                (
                    "id",
                    models.CharField(max_length=128, primary_key=True, serialize=False),
                ),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="jira_user",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Jira user",
                "verbose_name_plural": "Jira users",
            },
        ),
        migrations.CreateModel(
            name="JiraIssue",
            fields=[
                ("id", models.BigIntegerField(primary_key=True, serialize=False)),
                ("key", models.CharField(max_length=128)),
                ("issue_type", models.CharField(default="Incident", max_length=128)),
                ("project_key", models.CharField(default="INCIDENT", max_length=128)),
                ("description", models.TextField()),
                ("summary", models.CharField(help_text="Title", max_length=128)),
                (
                    "assignee",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="jira_ticket_assigned_set",
                        to="jira_app.jirauser",
                    ),
                ),
                (
                    "reporter",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="jira_ticket_reporter_set",
                        to="jira_app.jirauser",
                    ),
                ),
                (
                    "watchers",
                    models.ManyToManyField(
                        blank=True,
                        related_name="jira_ticket_watchers_set",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Jira issue",
                "verbose_name_plural": "Jira issue",
            },
        ),
    ]
