<?php

namespace App\Models;

use App\Enums\LogLevelEnum;
use Database\Factories\LogFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;

/**
 * @method static create(array<string, mixed> $array)
 *
 * @property LogLevelEnum $level
 * @property string $message
 * @property array<string, mixed> $context
 * @property Carbon $created_at
 * @property Carbon $updated_at
 */
class Log extends Model
{
    /** @use HasFactory<LogFactory> */
    use HasFactory;

    protected $table = 'logs';

    protected $fillable = [
        'level',
        'message',
        'context',
    ];

    protected $casts = [
        'level' => LogLevelEnum::class,
        'context' => 'array',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];
}
