<?php

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

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

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

    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

    /**
     * Check if user is admin
     */
    public function isAdmin()
    {
        return $this->role === 'admin';
    }

    /**
     * Check if user is verifikator
     */
    public function isVerifikator()
    {
        return $this->role === 'verifikator';
    }

    /**
     * Check if user is OPD
     */
    public function isOpd()
    {
        return $this->role === 'opd';
    }

    /**
     * Check if user can verify (admin or verifikator)
     */
    public function canVerify()
    {
        return in_array($this->role, ['admin', 'verifikator']);
    }
}



