# Generated by Django 5.1.5 on 2025-03-20 04:54

import access.fields
import access.models.tenancy
import devops.models.git_repository.base
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('access', '0004_organizationhistory_teamhistory'),
        ('devops', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='GitRepository',
            fields=[
                ('model_notes', models.TextField(blank=True, default=None, help_text='Tid bits of information', null=True, verbose_name='Notes')),
                ('id', models.AutoField(help_text='Primary key of the entry', primary_key=True, serialize=False, unique=True, verbose_name='ID')),
                ('provider', models.IntegerField(choices=[(1, 'GitHub'), (2, 'GitLab')], help_text='Who is the git Provider', verbose_name='Provider')),
                ('provider_id', models.IntegerField(help_text='Providers ID for this repository', unique=True, verbose_name='Provider ID')),
                ('path', models.CharField(help_text='Path to this repository, not including the organization', max_length=80, unique=True, validators=[devops.models.git_repository.base.GitRepository.validation_path], verbose_name='path')),
                ('name', models.CharField(help_text='Name of the repository', max_length=80, verbose_name='Name')),
                ('description', models.TextField(blank=True, help_text='Repository Description', max_length=300, null=True, verbose_name='Description')),
                ('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')),
            ],
            options={
                'verbose_name': 'GIT Repository',
                'verbose_name_plural': 'GIT Repositories',
                'ordering': ['organization', 'git_group', 'path'],
            },
        ),
        migrations.CreateModel(
            name='GitGroup',
            fields=[
                ('model_notes', models.TextField(blank=True, default=None, help_text='Tid bits of information', null=True, verbose_name='Notes')),
                ('id', models.AutoField(help_text='Primary key of the entry', primary_key=True, serialize=False, unique=True, verbose_name='ID')),
                ('provider', models.IntegerField(choices=[(1, 'GitHub'), (2, 'GitLab')], help_text='GIT Provider for this Group', verbose_name='Git Provider')),
                ('provider_pk', models.IntegerField(help_text='Providers ID for this Group', verbose_name='Provider ID')),
                ('name', models.CharField(help_text='Name of the Group', max_length=80, verbose_name='Name')),
                ('path', models.CharField(help_text='Path of the group', max_length=80, verbose_name='Path')),
                ('description', models.TextField(blank=True, help_text='Description for this group', max_length=300, null=True, verbose_name='Description')),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of creation', verbose_name='Created')),
                ('modifoed', access.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of last modification', verbose_name='Modified')),
                ('organization', models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists], verbose_name='Organization')),
                ('parent_group', models.ForeignKey(blank=True, default=None, help_text='Parent Git Group this repository belongs to.', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='devops.gitgroup', verbose_name='Parent Group')),
            ],
            options={
                'verbose_name': 'GIT Group',
                'verbose_name_plural': 'GIT Groups',
                'ordering': ['organization', 'path', 'name'],
                'unique_together': {('provider', 'provider_pk')},
            },
        ),
        migrations.CreateModel(
            name='GitHubRepository',
            fields=[
                ('gitrepository_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='devops.gitrepository')),
                ('wiki', models.BooleanField(default=False, help_text='Enable Wiki', verbose_name='Wiki')),
                ('issues', models.BooleanField(default=False, help_text='Enable Issues', verbose_name='Issues')),
                ('sponsorships', models.BooleanField(default=False, help_text='Enable Sponsorships', verbose_name='Sponsorships')),
                ('preserve_this_repository', models.BooleanField(default=False, help_text='Enable Preservation of this repository', verbose_name='Preserve This Repository')),
                ('discussions', models.BooleanField(default=False, help_text='Enable Discussions', verbose_name='Discussions')),
                ('projects', models.BooleanField(default=False, help_text='Enable Projects', verbose_name='Projects')),
            ],
            options={
                'verbose_name': 'GitHub Repository',
                'verbose_name_plural': 'GitHub Repositories',
                'abstract': False,
            },
            bases=('devops.gitrepository',),
        ),
        migrations.CreateModel(
            name='GitLabRepository',
            fields=[
                ('gitrepository_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='devops.gitrepository')),
                ('visibility', models.IntegerField(choices=[(1, 'Private'), (2, 'Internal'), (3, 'Public')], help_text='Visibility of this repository', verbose_name='Visibility')),
            ],
            options={
                'verbose_name': 'GitLab Repository',
                'verbose_name_plural': 'GitLab Repositories',
                'abstract': False,
            },
            bases=('devops.gitrepository',),
        ),
        migrations.AddField(
            model_name='gitrepository',
            name='git_group',
            field=models.ForeignKey(help_text='Git Group this repository belongs to.', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='devops.gitgroup', verbose_name='Group'),
        ),
        migrations.AddField(
            model_name='gitrepository',
            name='organization',
            field=models.ForeignKey(help_text='Organization this belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.organization', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists], verbose_name='Organization'),
        ),
    ]
