# Generated by Django 4.1 on 2022-08-25 13:16

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


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Notify",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "name",
                    models.CharField(
                        choices=[
                            ("wechat_work_push", "企业微信通知"),
                            ("wxpusher_push", "WxPusher通知"),
                            ("pushdeer_push", "PushDeer通知"),
                            ("bark_push", "Bark通知"),
                        ],
                        default="wechat_work_push",
                        max_length=64,
                        verbose_name="通知方式",
                    ),
                ),
                (
                    "enable",
                    models.BooleanField(
                        default=True, help_text="只有开启才能发送哦！", verbose_name="开启通知"
                    ),
                ),
                (
                    "corpid",
                    models.CharField(
                        blank=True,
                        help_text="微信企业ID",
                        max_length=64,
                        null=True,
                        verbose_name="企业ID",
                    ),
                ),
                (
                    "corpsecret",
                    models.CharField(
                        blank=True,
                        help_text="应用的Secret/Token",
                        max_length=64,
                        null=True,
                        verbose_name="Secret",
                    ),
                ),
                (
                    "agentid",
                    models.CharField(
                        blank=True,
                        help_text="APP ID",
                        max_length=64,
                        null=True,
                        verbose_name="应用ID",
                    ),
                ),
                (
                    "touser",
                    models.CharField(
                        blank=True,
                        help_text="接收者用户名/UID",
                        max_length=64,
                        null=True,
                        verbose_name="接收者",
                    ),
                ),
                (
                    "custom_server",
                    models.URLField(
                        blank=True,
                        help_text="无自定义服务器的，请勿填写！",
                        null=True,
                        verbose_name="自定义服务器",
                    ),
                ),
            ],
            options={"verbose_name": "通知推送", "verbose_name_plural": "通知推送",},
        ),
        migrations.CreateModel(
            name="OCR",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "name",
                    models.CharField(
                        choices=[("baidu_aip", "百度OCR")],
                        default="baidu_aip",
                        max_length=64,
                        verbose_name="OCR",
                    ),
                ),
                ("enable", models.BooleanField(default=False, verbose_name="启用")),
                (
                    "api_key",
                    models.CharField(
                        blank=True, max_length=64, null=True, verbose_name="API-Key"
                    ),
                ),
                (
                    "secret_key",
                    models.CharField(
                        blank=True,
                        help_text="应用的Secret",
                        max_length=64,
                        null=True,
                        verbose_name="Secret",
                    ),
                ),
                (
                    "app_id",
                    models.CharField(
                        blank=True,
                        help_text="APP ID",
                        max_length=64,
                        null=True,
                        verbose_name="应用ID",
                    ),
                ),
            ],
            options={"verbose_name": "OCR识别", "verbose_name_plural": "OCR识别",},
        ),
        migrations.CreateModel(
            name="Task",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                ("name", models.CharField(max_length=32, verbose_name="任务名称")),
                ("desc", models.CharField(max_length=32, verbose_name="任务描述")),
            ],
            options={
                "verbose_name": "任务",
                "verbose_name_plural": "任务",
                "ordering": ("name",),
            },
        ),
        migrations.CreateModel(
            name="TaskJob",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "job_id",
                    models.CharField(max_length=16, unique=True, verbose_name="任务ID"),
                ),
                (
                    "trigger",
                    models.CharField(
                        choices=[("interval", "间隔任务"), ("cron", "cron任务")],
                        default="cron",
                        max_length=64,
                        verbose_name="任务类型",
                    ),
                ),
                ("task_exec", models.BooleanField(default=False, verbose_name="开启任务")),
                (
                    "replace_existing",
                    models.BooleanField(
                        default=True,
                        help_text="不设置此项重启项目后会报任务id已存在的错误, 设置此参数后会对已有的任务进行覆盖",
                        verbose_name="覆盖任务",
                    ),
                ),
                (
                    "expression_time",
                    models.CharField(
                        help_text="在间隔任务表示间隔时长使用数字，单位：秒，corn任务中为corn表达式：“0 15 8 ? * * 2022”",
                        max_length=64,
                        verbose_name="时间表达式",
                    ),
                ),
                (
                    "start_date",
                    models.DateTimeField(blank=True, null=True, verbose_name="任务开始时间"),
                ),
                (
                    "end_date",
                    models.DateTimeField(blank=True, null=True, verbose_name="任务结束时间"),
                ),
                (
                    "misfire_grace_time",
                    models.IntegerField(
                        default=120,
                        help_text="强制执行结束的时间, 为避免撞车导致任务丢失, 没执行完就别执行了",
                        verbose_name="任务运行时间",
                    ),
                ),
                (
                    "jitter",
                    models.IntegerField(
                        default=120,
                        help_text="强制执行结束的时间, 为避免撞车导致任务丢失, 没执行完就别执行了",
                        verbose_name="时间浮动参数",
                    ),
                ),
                (
                    "args",
                    models.CharField(
                        blank=True,
                        help_text="执行代码所需要的参数。",
                        max_length=128,
                        null=True,
                        verbose_name="任务参数",
                    ),
                ),
                (
                    "task",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="auto_pt.task",
                        verbose_name="任务名称",
                    ),
                ),
            ],
            options={"verbose_name": "计划任务", "verbose_name_plural": "计划任务",},
        ),
    ]
