<?php

namespace App\Models;

use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;

class ImportLog extends Model
{
    use HasFactory, SoftDeletes, Blameable;

    // protected $keyType = 'string';

    // public $incrementing = false;

    protected $fillable = [
        'importable_type',
        'importable_id',
        'type',
        'file_path',
        'status',
        'progress',
    ];

    // protected static function boot()
    // {
    //     parent::boot();

    //     static::creating(function ($model) {
    //         try {
    //             $model->id = (string) Str::orderedUuid(); // generate uuid
    //         } catch (\Exception $e) {
    //             abort(500, $e->getMessage());
    //         }
    //     });
    // }

    public function files()
    {
        return $this->morphMany(File::class, 'fileable');
    }
}
