<?php

namespace App\Models\Auth;

use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;

class Permissions extends Model{

	protected $casts = [
		'hidden' => 'integer',
		'hiddenBreadcrumb' => 'integer',
		'affix' => 'integer',
		'fullpage' => 'integer',
	];
	protected $appends = ['meta'];

	protected function meta(): Attribute{
		return Attribute::make(
			get: fn ($value, $data) => [
				'title' => $data['title'],
				'type' => $data['type'],
				'icon' => $data['icon'],
				'color' => $data['color'],
				'hidden' => $data['hidden'],
				'hiddenBreadcrumb' => $data['hiddenBreadcrumb'],
				'affix' => $data['affix'],
				'fullpage' => $data['fullpage'],
			],
		);
	}
}
