<?php

namespace App\Domain\Identity\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class Permission extends Model
{
    public $timestamps = false;

    protected $fillable = [
        'name', 'module', 'action', 'description', 'description_ar',
    ];

    // created_at only (no updated_at)
    const CREATED_AT = 'created_at';
    const UPDATED_AT = null;

    public function roles(): BelongsToMany
    {
        return $this->belongsToMany(Role::class, 'permission_role')
            ->withPivot('scope', 'created_at');
    }
}
