<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class AdminUser extends Authenticatable
{
    use HasFactory, Notifiable;

    protected $fillable = ['name', 'email', 'password', 'role', 'status', 'force_change_password'];

    protected $hidden = ['password', 'remember_token'];

    protected function casts(): array
    {
        return ['password' => 'hashed', 'force_change_password' => 'boolean'];
    }

    public function isAdmin(): bool
    {
        return true;
    }

    public function isSystemAdmin(): bool
    {
        return $this->role === 'system_admin';
    }

    public function roleLabel(): string
    {
        return $this->isSystemAdmin() ? 'System Admin' : 'Admin';
    }
}
