<?php

declare(strict_types=1);

namespace App\Model;

/**
 * 操作日志模型
 *
 * 记录关键业务操作（用户管理、权限变更、登录退出）的审计追踪
 *
 * @property int $id
 * @property int $user_id
 * @property string $action
 * @property string $target_type
 * @property int|null $target_id
 * @property string $description
 * @property array|null $detail
 * @property string|null $ip
 * @property \Carbon\Carbon $created_at
 */
class OperationLog extends Model
{
    protected ?string $table = 'operation_logs';

    public bool $timestamps = true;

    public const UPDATED_AT = null;

    protected array $fillable = [
        'user_id', 'action', 'target_type', 'target_id',
        'description', 'detail', 'ip',
    ];

    protected array $casts = [
        'id' => 'integer',
        'user_id' => 'integer',
        'target_id' => 'integer',
        'detail' => 'json',
        'created_at' => 'datetime',
    ];
}
