# Generated by Django 4.0.8 on 2023-01-03 21:49

import django.core.serializers.json
from django.db import migrations, models
import django.db.models.deletion
import taggit.managers


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('extras', '0077_customlink_extend_text_and_url'),
        ('circuits', '0038_cabling_cleanup'),
        ('tenancy', '0007_contact_link'),
    ]

    operations = [
        migrations.CreateModel(
            name='Contract',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('name', models.CharField(max_length=100)),
                ('internal_partie', models.CharField(default='Active', max_length=50)),
                ('status', models.CharField(default='Active', max_length=50)),
                ('start_date', models.DateField()),
                ('initial_term', models.IntegerField(default=12)),
                ('renewal_term', models.IntegerField(default=12)),
                ('mrc', models.DecimalField(decimal_places=2, max_digits=10)),
                ('nrc', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('invoice_frequency', models.IntegerField(default=1)),
                ('comments', models.TextField(blank=True)),
                ('circuit', models.ManyToManyField(related_name='contract', to='circuits.circuit')),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='ServiceProvider',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('portal_url', models.URLField(blank=True)),
                ('comments', models.TextField(blank=True)),
                ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='Invoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder)),
                ('number', models.CharField(max_length=100)),
                ('period_start', models.DateField()),
                ('period_end', models.DateField()),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('contract', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoice', to='netbox_contract.contract')),
                ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
            ],
            options={
                'ordering': ('-period_start',),
            },
        ),
        migrations.AddField(
            model_name='contract',
            name='external_partie',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contract', to='netbox_contract.serviceprovider'),
        ),
        migrations.AddField(
            model_name='contract',
            name='tags',
            field=taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag'),
        ),
        migrations.AddField(
            model_name='contract',
            name='tenant',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='tenancy.tenant'),
        ),
    ]
