# Generated by Django 5.1.4 on 2024-12-20 08:34

import access.fields
import access.models
import assistance.models.model_knowledge_base_article
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('access', '0002_alter_organization_options_alter_team_options_and_more'),
        ('assistance', '0002_alter_knowledgebase_options_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='ModelKnowledgeBaseArticle',
            fields=[
                ('is_global', models.BooleanField(default=False, help_text='Is this a global object?', verbose_name='Global Object')),
                ('id', models.AutoField(help_text='ID of this KB article link', primary_key=True, serialize=False, unique=True, verbose_name='ID')),
                ('model', models.CharField(choices=assistance.models.model_knowledge_base_article.all_models, help_text='Model type to link to article article', max_length=50, verbose_name='Model Type')),
                ('model_pk', models.IntegerField(help_text='PK of the model the article is linked to', verbose_name='Model Primary Key')),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of creation', verbose_name='Created')),
                ('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of last modification', verbose_name='Modified')),
                ('article', models.ForeignKey(help_text='Article to be linked to model', on_delete=django.db.models.deletion.CASCADE, to='assistance.knowledgebase', verbose_name='Article')),
                ('organization', models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists], verbose_name='Organization')),
            ],
            options={
                'verbose_name': 'Model Knowledge Base Article',
                'verbose_name_plural': 'Model Knowledge Base Articles',
                'ordering': ['model', 'id'],
                'default_permissions': ('add', 'delete', 'view'),
                'unique_together': {('article', 'model', 'model_pk')},
            },
        ),
    ]
