# Generated by Django 5.0.8 on 2024-10-11 14:09

import access.models
import core.models.ticket.ticket_comment
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('access', '0001_initial'),
        ('assistance', '0001_initial'),
        ('core', '0005_ticketcategory_ticketcomment_ticketcommentcategory_and_more'),
        ('project_management', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='ticket',
            name='milestone',
            field=models.ForeignKey(blank=True, help_text='Assign to a milestone', null=True, on_delete=django.db.models.deletion.SET_NULL, to='project_management.projectmilestone', verbose_name='Project Milestone'),
        ),
        migrations.AddField(
            model_name='ticket',
            name='opened_by',
            field=models.ForeignKey(help_text='Who is the ticket for', on_delete=django.db.models.deletion.DO_NOTHING, related_name='opened_by', to=settings.AUTH_USER_MODEL, verbose_name='Opened By'),
        ),
        migrations.AddField(
            model_name='ticket',
            name='organization',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists]),
        ),
        migrations.AddField(
            model_name='ticket',
            name='project',
            field=models.ForeignKey(blank=True, help_text='Assign to a project', null=True, on_delete=django.db.models.deletion.SET_NULL, to='project_management.project', verbose_name='Project'),
        ),
        migrations.AddField(
            model_name='ticket',
            name='subscribed_teams',
            field=models.ManyToManyField(blank=True, help_text='Subscribe a Team(s) to the ticket to receive updates', related_name='subscribed_teams', to='access.team', verbose_name='Subscribed Team(s)'),
        ),
        migrations.AddField(
            model_name='ticket',
            name='subscribed_users',
            field=models.ManyToManyField(blank=True, help_text='Subscribe a User(s) to the ticket to receive updates', related_name='subscribed_users', to=settings.AUTH_USER_MODEL, verbose_name='Subscribed User(s)'),
        ),
        migrations.AddField(
            model_name='relatedtickets',
            name='from_ticket_id',
            field=models.ForeignKey(help_text='This Ticket', on_delete=django.db.models.deletion.CASCADE, related_name='from_ticket_id', to='core.ticket', verbose_name='Ticket'),
        ),
        migrations.AddField(
            model_name='relatedtickets',
            name='to_ticket_id',
            field=models.ForeignKey(help_text='The Related Ticket', on_delete=django.db.models.deletion.CASCADE, related_name='to_ticket_id', to='core.ticket', verbose_name='Related Ticket'),
        ),
        migrations.AddField(
            model_name='ticketcategory',
            name='organization',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists]),
        ),
        migrations.AddField(
            model_name='ticketcategory',
            name='parent',
            field=models.ForeignKey(blank=True, help_text='The Parent Category', null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.ticketcategory', verbose_name='Parent Category'),
        ),
        migrations.AddField(
            model_name='ticketcategory',
            name='runbook',
            field=models.ForeignKey(blank=True, help_text='The runbook for this category', null=True, on_delete=django.db.models.deletion.SET_NULL, to='assistance.knowledgebase', verbose_name='Runbook'),
        ),
        migrations.AddField(
            model_name='ticket',
            name='category',
            field=models.ForeignKey(blank=True, help_text='Category for this ticket', null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.ticketcategory', verbose_name='Category'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='organization',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists]),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='parent',
            field=models.ForeignKey(blank=True, default=None, help_text='Parent ID for creating discussion threads', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='core.ticketcomment', verbose_name='Parent Comment'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='responsible_team',
            field=models.ForeignKey(blank=True, default=None, help_text='Team whom is responsible for the completion of comment', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='comment_responsible_team', to='access.team', verbose_name='Responsible Team'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='responsible_user',
            field=models.ForeignKey(blank=True, default=None, help_text='User whom is responsible for the completion of comment', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='comment_responsible_user', to=settings.AUTH_USER_MODEL, verbose_name='Responsible User'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='template',
            field=models.ForeignKey(blank=True, default=None, help_text='Comment Template to use', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='comment_template', to='core.ticketcomment', verbose_name='Template'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='ticket',
            field=models.ForeignKey(blank=True, default=None, help_text='Ticket this comment belongs to', null=True, on_delete=django.db.models.deletion.CASCADE, to='core.ticket', validators=[core.models.ticket.ticket_comment.TicketComment.validation_ticket_id], verbose_name='Ticket'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='user',
            field=models.ForeignKey(blank=True, help_text='Who made the comment', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='comment_user', to=settings.AUTH_USER_MODEL, verbose_name='User'),
        ),
        migrations.AddField(
            model_name='ticketcommentcategory',
            name='organization',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists]),
        ),
        migrations.AddField(
            model_name='ticketcommentcategory',
            name='parent',
            field=models.ForeignKey(blank=True, help_text='The Parent Category', null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.ticketcommentcategory', verbose_name='Parent Category'),
        ),
        migrations.AddField(
            model_name='ticketcommentcategory',
            name='runbook',
            field=models.ForeignKey(blank=True, help_text='The runbook for this category', null=True, on_delete=django.db.models.deletion.SET_NULL, to='assistance.knowledgebase', verbose_name='Runbook'),
        ),
        migrations.AddField(
            model_name='ticketcomment',
            name='category',
            field=models.ForeignKey(blank=True, default=None, help_text='Category of the comment', null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.ticketcommentcategory', verbose_name='Category'),
        ),
        migrations.AddField(
            model_name='ticketlinkeditem',
            name='organization',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists]),
        ),
        migrations.AddField(
            model_name='ticketlinkeditem',
            name='ticket',
            field=models.ForeignKey(help_text='Ticket the item will be linked to', on_delete=django.db.models.deletion.CASCADE, to='core.ticket', verbose_name='Ticket'),
        ),
        migrations.AlterUniqueTogether(
            name='ticket',
            unique_together={('external_system', 'external_ref')},
        ),
        migrations.AlterUniqueTogether(
            name='ticketcomment',
            unique_together={('external_system', 'external_ref')},
        ),
    ]
