# Generated by Django 3.2.3 on 2022-02-15 21:22

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

import common.base.daobase


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('api', '__first__'),
    ]

    operations = [
        migrations.CreateModel(
            name='AppIOSDeveloperInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('issuer_id', models.CharField(max_length=64, verbose_name='标识创建认证令牌的发放者')),
                ('private_key_id', models.CharField(max_length=64, verbose_name='密钥 ID')),
                ('p8key', common.base.daobase.AESCharField(max_length=512, verbose_name='p8key')),
                ('certid', models.CharField(blank=True, max_length=64, null=True, verbose_name='超级签名自动创建证书ID')),
                ('usable_number', models.IntegerField(default=100, verbose_name='可使用设备数')),
                ('app_limit_number', models.IntegerField(default=100, verbose_name='可分配应用数，最大160')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('cert_expire_time', models.DateTimeField(blank=True, null=True, verbose_name='证书过期时间')),
                ('description', models.TextField(blank=True, default='', null=True, verbose_name='备注')),
                ('auth_type', models.SmallIntegerField(choices=[(0, 'p8key认证')], default=0, verbose_name='认证类型')),
                ('status', models.SmallIntegerField(
                    choices=[(-1, '疑似被封'), (0, '未激活'), (1, '已激活'), (2, '协议待同意'), (3, '维护中'), (4, '证书过期'), (5, '状态异常')],
                    default=0, verbose_name='账户状态')),
                ('clean_status', models.BooleanField(default=False, verbose_name='清理是否同时禁用设备ID')),
                ('auto_check', models.BooleanField(default=False, verbose_name='是否自动检测开发者状态')),
                ('abnormal_register', models.BooleanField(default=True, verbose_name='设备异常状态是否注册')),
                ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
                                              verbose_name='用户ID')),
            ],
            options={
                'verbose_name': '苹果开发者账户',
                'verbose_name_plural': '苹果开发者账户',
                'unique_together': {('user_id', 'issuer_id')},
            },
        ),
        migrations.CreateModel(
            name='UDIDsyncDeveloper',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('udid', models.CharField(db_index=True, max_length=64, verbose_name='udid唯一标识')),
                ('product', models.CharField(blank=True, max_length=64, null=True, verbose_name='产品')),
                ('serial', models.CharField(blank=True, max_length=64, null=True, verbose_name='序列号')),
                ('version', models.CharField(blank=True, max_length=64, null=True, verbose_name='型号')),
                ('status', models.BooleanField(default=False, verbose_name='设备在开发者平台状态')),
                ('developerid',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appiosdeveloperinfo',
                                   verbose_name='所使用苹果开发者账户')),
            ],
            options={
                'verbose_name': 'iOS开发平台同步设备信息',
                'verbose_name_plural': 'iOS开发平台同步设备信息',
                'unique_together': {('udid', 'developerid')},
            },
        ),
        migrations.CreateModel(
            name='IosDeveloperPublicPoolBill',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.IntegerField(default=1, verbose_name='消耗次数')),
                ('app_info', models.JSONField(blank=True, max_length=256, null=True, verbose_name='属于哪个APP')),
                ('udid', models.CharField(blank=True, max_length=64, null=True, verbose_name='设备udid')),
                ('product', models.CharField(blank=True, max_length=64, null=True, verbose_name='设备udid')),
                ('version', models.CharField(blank=True, max_length=64, null=True, verbose_name='设备udid')),
                ('developer_info', models.JSONField(blank=True, max_length=256, null=True, verbose_name='开发者信息')),
                ('description', models.CharField(blank=True, default='', max_length=128, verbose_name='操作描述')),
                ('remote_addr', models.GenericIPAddressField(verbose_name='远程IP地址')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
                ('app_id',
                 models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.apps',
                                   verbose_name='属于哪个APP')),
                ('udid_sync_info',
                 models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
                                   to='xsign.udidsyncdeveloper', verbose_name='关联同步设备信息')),
                ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
                                              verbose_name='用户ID')),
            ],
            options={
                'verbose_name': '设备消耗账单',
                'verbose_name_plural': '设备消耗账单',
            },
        ),
        migrations.CreateModel(
            name='IosDeveloperBill',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.SmallIntegerField(choices=[(0, '失效'), (1, '已撤回'), (2, '成功')], default=0,
                                                    help_text='0 失效 1 撤回 2 转账', verbose_name='状态')),
                ('number', models.IntegerField(default=1, verbose_name='设备数量')),
                ('description', models.CharField(blank=True, default='', max_length=128, verbose_name='操作描述')),
                ('remote_addr', models.GenericIPAddressField(verbose_name='远程IP地址')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('to_user_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
                                                 related_name='to_user_id', to=settings.AUTH_USER_MODEL,
                                                 verbose_name='用户ID')),
                ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='org_user_id',
                                              to=settings.AUTH_USER_MODEL, verbose_name='用户ID')),
            ],
            options={
                'verbose_name': '设备划转账单',
                'verbose_name_plural': '设备划转账单',
            },
        ),
        migrations.CreateModel(
            name='AppUDID',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product', models.CharField(blank=True, max_length=64, null=True, verbose_name='产品')),
                ('serial', models.CharField(blank=True, max_length=64, null=True, verbose_name='序列号')),
                ('version', models.CharField(blank=True, max_length=64, null=True, verbose_name='型号')),
                ('imei', models.CharField(blank=True, max_length=64, null=True, verbose_name='型号')),
                ('iccid', models.CharField(blank=True, max_length=64, null=True, verbose_name='型号')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('sign_status', models.SmallIntegerField(
                    choices=[(0, '新设备入库准备'), (1, '设备ID已经注册'), (2, 'bundelid已经注册'), (3, '描述文件已经下载'), (4, '已经完成签名打包')],
                    default=0, verbose_name='签名状态')),
                ('app_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.apps', verbose_name='属于哪个APP')),
                ('udid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.udidsyncdeveloper',
                                           verbose_name='udid唯一标识')),
            ],
            options={
                'verbose_name': '设备详情',
                'verbose_name_plural': '设备详情',
                'unique_together': {('app_id', 'udid')},
            },
        ),
        migrations.CreateModel(
            name='APPToDeveloper',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('binary_file',
                 models.CharField(blank=True, max_length=128, null=True, unique=True, verbose_name='签名包名称')),
                ('release_file', models.CharField(blank=True, max_length=128, null=True, verbose_name='源包名称')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('app_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.apps', verbose_name='属于哪个APP')),
                ('developerid',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appiosdeveloperinfo',
                                   verbose_name='所使用苹果开发者账户')),
            ],
            options={
                'verbose_name': '应用开发者绑定',
                'verbose_name_plural': '应用开发者绑定',
            },
        ),
        migrations.CreateModel(
            name='APPSuperSignUsedInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('app_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.apps', verbose_name='属于哪个APP')),
                ('developerid',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appiosdeveloperinfo',
                                   verbose_name='所使用苹果开发者账户')),
                ('udid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appudid',
                                           verbose_name='所消耗的udid')),
                ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
                                              verbose_name='用户ID')),
            ],
            options={
                'verbose_name': '设备使用统计',
                'verbose_name_plural': '设备使用统计',
            },
        ),
        migrations.CreateModel(
            name='DeveloperDevicesID',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('did', models.CharField(max_length=64)),
                ('app_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.apps', verbose_name='属于哪个APP')),
                ('developerid',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appiosdeveloperinfo',
                                   verbose_name='所使用苹果开发者账户')),
                ('udid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.udidsyncdeveloper',
                                           verbose_name='所消耗的udid')),
            ],
            options={
                'verbose_name': '超级签Devices id',
                'verbose_name_plural': '超级签Devices id',
                'unique_together': {('did', 'developerid', 'app_id')},
            },
        ),
        migrations.CreateModel(
            name='DeveloperAppID',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('aid', models.CharField(max_length=64)),
                ('profile_id', models.CharField(blank=True, max_length=64, null=True)),
                ('app_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.apps', verbose_name='属于哪个APP')),
                ('developerid',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appiosdeveloperinfo',
                                   verbose_name='所使用苹果开发者账户')),
            ],
            options={
                'verbose_name': '超级签APP id',
                'verbose_name_plural': '超级签APP id',
                'unique_together': {('aid', 'developerid', 'app_id')},
            },
        ),
        migrations.CreateModel(
            name='AppleDeveloperToAppUse',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('usable_number', models.IntegerField(default=100, verbose_name='可使用设备数')),
                ('description', models.CharField(blank=True, default='', max_length=256, verbose_name='备注')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
                ('app_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.apps')),
                ('developerid',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xsign.appiosdeveloperinfo')),
            ],
            options={
                'verbose_name': '开发者专属于应用',
                'verbose_name_plural': '开发者专属于应用',
                'unique_together': {('app_id', 'developerid')},
            },
        ),
    ]
