<?php

namespace Maestro\Core\Models;

use Spatie\Activitylog\LogOptions;

class OrganizationSetting extends BaseModel
{
    protected $table = 'organization_settings';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'company_name',
        'street',
        'house_number',
        'postal_code',
        'city',
        'country',
        'website',
        'phone',
        'email',
        'invoice_email',
        'kvk_number',
        'vat_number',
        'iban',
        'contact_name',
        'created_by',
        'updated_by',
    ];

    public function getActivitylogOptions(): LogOptions
    {
        return LogOptions::defaults()
            ->useLogName('organization_settings')
            ->logOnly(['company_name', 'street', 'house_number', 'postal_code', 'city', 'country', 'website', 'phone', 'email', 'invoice_email', 'contact_name'])
            ->logOnlyDirty()
            ->dontSubmitEmptyLogs()
            ->setDescriptionForEvent(fn (string $eventName) => match ($eventName) {
                'created' => 'Organization settings created',
                'updated' => 'Organization settings updated',
                'deleted' => 'Organization settings deleted',
                default => 'Organization settings ' . $eventName,
            });
    }
}
