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

import access.fields
import access.models
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Project',
            fields=[
                ('is_global', models.BooleanField(default=False)),
                ('id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
                ('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('slug', access.fields.AutoSlugField()),
                ('external_ref', models.IntegerField(blank=True, default=None, help_text='External System reference', null=True, verbose_name='Reference Number')),
                ('external_system', models.IntegerField(blank=True, choices=[(1, 'Github'), (2, 'Gitlab'), (9999, 'Custom #1 (Imported)'), (9998, 'Custom #2 (Imported)'), (9997, 'Custom #3 (Imported)'), (9996, 'Custom #4 (Imported)'), (9995, 'Custom #5 (Imported)'), (9994, 'Custom #6 (Imported)'), (9993, 'Custom #7 (Imported)'), (9992, 'Custom #8 (Imported)'), (9991, 'Custom #9 (Imported)')], default=None, help_text='External system this item derives', null=True, verbose_name='External System')),
                ('description', models.TextField(blank=True, default=None, null=True)),
                ('priority', models.IntegerField(choices=[(1, 'Very Low'), (2, 'Low'), (3, 'Medium'), (4, 'High'), (5, 'Very High'), (6, 'Major')], default=2, help_text='Priority of the project', null=True, verbose_name='Priority')),
                ('code', models.CharField(blank=True, help_text='Project Code', max_length=25, null=True, unique=True, verbose_name='Project Code')),
                ('planned_start_date', models.DateTimeField(blank=True, help_text='When the project is planned to have been started by.', null=True, verbose_name='Planned Start Date')),
                ('planned_finish_date', models.DateTimeField(blank=True, help_text='When the project is planned to be finished by.', null=True, verbose_name='Planned Finish Date')),
                ('real_start_date', models.DateTimeField(blank=True, help_text='When work commenced on the project.', null=True, verbose_name='Real Start Date')),
                ('real_finish_date', models.DateTimeField(blank=True, help_text='When work was completed for the project', null=True, verbose_name='Real Finish Date')),
                ('is_deleted', models.BooleanField(default=False, help_text='Is this project considered deleted', verbose_name='Deleted')),
                ('manager_team', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='access.team')),
                ('manager_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='manager_user', to=settings.AUTH_USER_MODEL)),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists])),
                ('team_members', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Project',
                'verbose_name_plural': 'Projects',
                'ordering': ['code', 'name'],
                'permissions': [('import_project', 'Can import a project')],
            },
        ),
        migrations.CreateModel(
            name='ProjectMilestone',
            fields=[
                ('is_global', models.BooleanField(default=False)),
                ('id', models.AutoField(primary_key=True, serialize=False, unique=True)),
                ('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('slug', access.fields.AutoSlugField()),
                ('description', models.TextField(blank=True, default=None, help_text='Description of milestone. Markdown supported', null=True, verbose_name='Description')),
                ('start_date', models.DateTimeField(blank=True, help_text='When work commenced on the project.', null=True, verbose_name='Real Start Date')),
                ('finish_date', models.DateTimeField(blank=True, help_text='When work was completed for the project', null=True, verbose_name='Real Finish Date')),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists])),
                ('project', models.ForeignKey(help_text='Project this milestone belongs.', on_delete=django.db.models.deletion.CASCADE, to='project_management.project')),
            ],
            options={
                'verbose_name': 'Project Milestone',
                'verbose_name_plural': 'Project Milestones',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='ProjectState',
            fields=[
                ('is_global', models.BooleanField(default=False)),
                ('model_notes', models.TextField(blank=True, default=None, null=True, verbose_name='Notes')),
                ('id', models.AutoField(help_text='State ID Number', primary_key=True, serialize=False, unique=True, verbose_name='Number')),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
                ('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
                ('name', models.CharField(help_text='Name of thee project state.', max_length=50, unique=True, verbose_name='Name')),
                ('is_completed', models.BooleanField(default=False, help_text='Is this state considered complete', verbose_name='State Completed')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists])),
                ('runbook', models.ForeignKey(blank=True, help_text='The runbook for this project state', null=True, on_delete=django.db.models.deletion.SET_NULL, to='assistance.knowledgebase', verbose_name='Runbook')),
            ],
            options={
                'verbose_name': 'Project State',
                'verbose_name_plural': 'Project States',
                'ordering': ['name'],
            },
        ),
        migrations.AddField(
            model_name='project',
            name='state',
            field=models.ForeignKey(blank=True, help_text='State of the project', null=True, on_delete=django.db.models.deletion.SET_NULL, to='project_management.projectstate', verbose_name='Project State'),
        ),
        migrations.CreateModel(
            name='ProjectType',
            fields=[
                ('is_global', models.BooleanField(default=False)),
                ('model_notes', models.TextField(blank=True, default=None, null=True, verbose_name='Notes')),
                ('id', models.AutoField(help_text='Type ID Number', primary_key=True, serialize=False, unique=True, verbose_name='Number')),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
                ('modified', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
                ('name', models.CharField(help_text='Name of thee project type.', max_length=50, unique=True, verbose_name='Name')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists])),
                ('runbook', models.ForeignKey(blank=True, help_text='The runbook for this project type', null=True, on_delete=django.db.models.deletion.SET_NULL, to='assistance.knowledgebase', verbose_name='Runbook')),
            ],
            options={
                'verbose_name': 'Project Type',
                'verbose_name_plural': 'Project Types',
                'ordering': ['name'],
            },
        ),
        migrations.AddField(
            model_name='project',
            name='project_type',
            field=models.ForeignKey(blank=True, help_text='Type of project', null=True, on_delete=django.db.models.deletion.SET_NULL, to='project_management.projecttype', verbose_name='Project Type'),
        ),
    ]
