<?php

namespace Modules\Asset\Entities;

use App\Models\BaseModel;
use App\Models\ModuleSetting;
use App\Traits\HasCompany;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\File;
use Nwidart\Modules\Facades\Module;

class AssetSetting extends BaseModel
{

    protected $table = 'asset_settings';

    const MODULE_NAME = 'asset';

    protected $hidden = [
        'created_at',
        'updated_at',
    ];

    protected $guarded = [
        'id',
        'created_at',
        'updated_at',
    ];


    protected $dates = [
        'created_at',
        'updated_at'
    ];

    public function history(): HasMany
    {
        return $this->hasMany(AssetHistory::class);
    }

    public static function addModuleSetting($company)
    {
        $roles = ['employee', 'admin'];
        ModuleSetting::createRoleSettingEntry(self::MODULE_NAME, $roles, $company);
    }

}
