# Generated by Django 5.1.9 on 2025-05-16 09:58

import access.fields
import access.models.tenancy
import accounting.models.asset_base
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('access', '0010_company_alter_entity_entity_type_alter_person_dob_and_more'),
        ('core', '0023_ticketcommentaction_alter_manufacturer_organization_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='AssetBase',
            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='Ticket ID Number', primary_key=True, serialize=False, unique=True, verbose_name='Number')),
                ('asset_number', models.CharField(blank=True, help_text='Number or tag to use to track this asset', max_length=30, null=True, unique=True, verbose_name='Asset Number')),
                ('serial_number', models.CharField(blank=True, help_text='Serial number of this asset assigned by manufacturer.', max_length=30, null=True, unique=True, verbose_name='Serial Number')),
                ('asset_type', models.CharField(blank=True, choices=accounting.models.asset_base.AssetBase.get_model_type_choices, default='asset', help_text='Asset Type. (derived from asset model)', max_length=30, validators=[accounting.models.asset_base.AssetBase.validate_not_null], verbose_name='Asset Type')),
                ('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')),
                ('organization', models.ForeignKey(help_text='Tenancy this belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.tenant', validators=[access.models.tenancy.TenancyObject.validatate_organization_exists], verbose_name='Tenant')),
            ],
            options={
                'verbose_name': 'Asset',
                'verbose_name_plural': 'Assets',
                'ordering': ['id'],
                'sub_model_type': 'asset',
            },
        ),
        migrations.CreateModel(
            name='AssetBaseHistory',
            fields=[
                ('modelhistory_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelhistory')),
                ('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='history', to='accounting.assetbase', verbose_name='Model')),
            ],
            options={
                'verbose_name': 'Asset History',
                'verbose_name_plural': 'Asset History',
                'db_table': 'accounting_assetbase_history',
                'ordering': ['-created'],
            },
            bases=('core.modelhistory',),
        ),
        migrations.CreateModel(
            name='AssetBaseNotes',
            fields=[
                ('modelnotes_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelnotes')),
                ('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='accounting.assetbase', verbose_name='Model')),
            ],
            options={
                'verbose_name': 'Asset Note',
                'verbose_name_plural': 'Asset Notes',
                'db_table': 'accounting_assetbase_notes',
                'ordering': ['-created'],
            },
            bases=('core.modelnotes',),
        ),
    ]
