<?php

namespace App\Models\System;

use App\Traits\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Task extends Model
{
    use ModelTrait, SoftDeletes;

    protected $table = 'system_task';

    protected $fillable = [
        'name',
        'command',
        'description',
        'type',
        'expression',
        'timezone',
        'is_active',
        'run_in_background',
        'without_overlapping',
        'only_one',
        'last_run_at',
        'next_run_at',
        'last_output',
        'run_count',
        'failed_count',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'run_in_background' => 'boolean',
        'without_overlapping' => 'boolean',
        'only_one' => 'boolean',
        'last_run_at' => 'datetime',
        'next_run_at' => 'datetime',
        'run_count' => 'integer',
        'failed_count' => 'integer',
    ];
}
