<?php

namespace App\Modules\Inventory\Support;

use Illuminate\Database\Eloquent\Model;

/**
 * @mixin Model
 */
trait LogsInventoryCatalogActivity
{
    protected static function bootLogsInventoryCatalogActivity(): void
    {
        static::created(function (Model $model): void {
            InventoryCatalogActivityLog::record($model, 'created');
        });

        static::updated(function (Model $model): void {
            InventoryCatalogActivityLog::record($model, 'updated');
        });

        static::deleted(function (Model $model): void {
            InventoryCatalogActivityLog::record($model, 'deleted');
        });
    }
}
