<?php

declare(strict_types=1);

namespace App\Models;

/**
 * @property int $id
 * @property string $hashkey
 * @property string $file_content_hashkey
 * @property string $filename
 * @property int $size_in_bytes
 * @property bool $is_active
 * @property int $created_by
 * @property int $updated_by
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 */
class DbBackup extends Model
{
    protected ?string $table = 'db_backups';

    protected array $fillable = [
        'hashkey',
        'name',
        'file_content_hashkey',
        'filename',
        'size_in_bytes',
        'is_active',
        'created_by',
        'updated_by',
    ];

    protected array $casts = [
        'id' => 'integer',
        'size_in_bytes' => 'integer',
        'is_active' => 'boolean',
        'created_by' => 'integer',
        'updated_by' => 'integer',
    ];

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }

    public function updater()
    {
        return $this->belongsTo(User::class, 'updated_by');
    }
}
