<?php

namespace App\Modules\Admin\Operations\Models;

use Illuminate\Database\Eloquent\Model;

class BackupRun extends Model
{
    public const TYPE_DB = 'db';
    public const TYPE_FILES = 'files';

    public const STATUS_SUCCESS = 'success';
    public const STATUS_FAILED = 'failed';

    protected $fillable = [
        'type',
        'status',
        'started_at',
        'completed_at',
        'restore_verified_at',
        'error_message',
        'metadata',
    ];

    protected function casts(): array
    {
        return [
            'started_at' => 'datetime',
            'completed_at' => 'datetime',
            'restore_verified_at' => 'datetime',
            'metadata' => 'array',
        ];
    }
}

