# Generated by Django 6.0.2 on 2026-02-18 21:52

import django.db.models.deletion
import django.db.models.expressions
import encrypted_field.fields
from decimal import Decimal
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('terminusgps_payments', '0003_alter_subscription_amount_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='WialonResource',
            fields=[
                ('id', models.PositiveBigIntegerField(primary_key=True, serialize=False)),
                ('nm', models.CharField(blank=True, max_length=50)),
                ('mu', models.IntegerField(blank=True, default=0)),
                ('uacl', models.IntegerField(blank=True, default=0)),
            ],
            options={
                'verbose_name': 'wialon resource',
                'verbose_name_plural': 'wialon resources',
            },
        ),
        migrations.CreateModel(
            name='WialonToken',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', encrypted_field.fields.EncryptedField(max_length=72)),
            ],
            options={
                'verbose_name': 'wialon token',
                'verbose_name_plural': 'wialon tokens',
            },
        ),
        migrations.CreateModel(
            name='WialonUnit',
            fields=[
                ('id', models.PositiveBigIntegerField(primary_key=True, serialize=False)),
                ('nm', models.CharField(blank=True, max_length=50)),
                ('mu', models.IntegerField(blank=True, default=0)),
                ('uacl', models.IntegerField(blank=True, default=0)),
            ],
            options={
                'verbose_name': 'wialon unit',
                'verbose_name_plural': 'wialon units',
            },
        ),
        migrations.CreateModel(
            name='WialonUnitGroup',
            fields=[
                ('id', models.PositiveBigIntegerField(primary_key=True, serialize=False)),
                ('nm', models.CharField(blank=True, max_length=50)),
                ('mu', models.IntegerField(blank=True, default=0)),
                ('uacl', models.IntegerField(blank=True, default=0)),
            ],
            options={
                'verbose_name': 'wialon unit group',
                'verbose_name_plural': 'wialon unit groups',
            },
        ),
        migrations.CreateModel(
            name='TerminusGPSNotifierCustomer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('messages_count', models.PositiveIntegerField(default=0)),
                ('messages_limit', models.PositiveIntegerField(default=500)),
                ('tax_rate', models.DecimalField(decimal_places=2, default=Decimal('0.0825'), help_text='Enter a tax rate as a decimal.', max_digits=12)),
                ('sub_total', models.DecimalField(decimal_places=2, default=Decimal('60.00'), help_text='Enter a sub total as a decimal.', max_digits=12)),
                ('tax_total', models.GeneratedField(db_persist=True, expression=django.db.models.expressions.CombinedExpression(django.db.models.expressions.CombinedExpression(models.F('sub_total'), '*', django.db.models.expressions.CombinedExpression(models.F('tax_rate'), '+', models.Value(1))), '-', models.F('sub_total')), help_text='Automatically generated tax amount.', output_field=models.DecimalField(decimal_places=2, max_digits=12))),
                ('grand_total', models.GeneratedField(db_persist=True, expression=django.db.models.expressions.CombinedExpression(models.F('sub_total'), '*', django.db.models.expressions.CombinedExpression(models.F('tax_rate'), '+', models.Value(1))), help_text='Automatically generated grand total amount (sub+tax).', output_field=models.DecimalField(decimal_places=2, max_digits=12))),
                ('subscription', models.ForeignKey(blank=True, default=None, help_text='Select an Authorizenet subscription from the list.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notifier_customer', to='terminusgps_payments.subscription')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifier_customer', to=settings.AUTH_USER_MODEL)),
                ('token', models.OneToOneField(blank=True, default=None, help_text='Select a Wialon API token from the list.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notifier_customer', to='terminusgps_notifier.wialontoken')),
            ],
            options={
                'verbose_name': 'customer',
                'verbose_name_plural': 'customers',
            },
        ),
        migrations.CreateModel(
            name='MessagePackage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('count', models.IntegerField(default=0)),
                ('limit', models.IntegerField(default=500)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='packages', to='terminusgps_notifier.terminusgpsnotifiercustomer')),
            ],
            options={
                'verbose_name': 'message package',
                'verbose_name_plural': 'message packages',
            },
        ),
        migrations.CreateModel(
            name='WialonNotification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('wialon_id', models.IntegerField(blank=True)),
                ('e', models.IntegerField(blank=True, default=1, verbose_name='enabled')),
                ('n', models.CharField(blank=True, max_length=50)),
                ('txt', models.CharField(blank=True, max_length=1024)),
                ('ta', models.IntegerField(blank=True, default=0)),
                ('td', models.IntegerField(blank=True, default=0)),
                ('ma', models.IntegerField(blank=True, default=0)),
                ('mmtd', models.IntegerField(blank=True, default=0)),
                ('cdt', models.IntegerField(blank=True, default=0)),
                ('mast', models.IntegerField(blank=True, default=0)),
                ('mpst', models.IntegerField(blank=True, default=0)),
                ('cp', models.IntegerField(blank=True, default=0)),
                ('fl', models.IntegerField(choices=[(0, 'First Message'), (1, 'Every Message'), (2, 'Disabled')], default=0)),
                ('tz', models.IntegerField(blank=True, default=0)),
                ('la', models.CharField(blank=True, default='en', max_length=2)),
                ('ac', models.IntegerField(blank=True, default=0)),
                ('un', models.JSONField(blank=True, default=list)),
                ('d', models.CharField(blank=True)),
                ('sch', models.JSONField(blank=True, default=dict)),
                ('ctrl_sch', models.JSONField(blank=True, default=dict)),
                ('trg', models.JSONField(blank=True, default=dict)),
                ('act', models.JSONField(blank=True, default=dict)),
                ('ct', models.IntegerField(blank=True, default=0)),
                ('mt', models.IntegerField(blank=True, default=0)),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to='terminusgps_notifier.wialonresource')),
            ],
            options={
                'verbose_name': 'wialon notification',
                'verbose_name_plural': 'wialon notifications',
            },
        ),
    ]
