<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use NotificationChannels\WebPush\HasPushSubscriptions;
 
class User extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable, HasPushSubscriptions;

    

    /**
     * The attributes that are mass assignable.
     *
     * @var list<string>
     */
    protected $table = 't_personas';
    protected $primaryKey = 'idPersona';
    public $incrementing = false;
    protected $username = 'name';
    protected $keyType = 'string';
    protected $fillable = [
        'idPersona',
        'name',
        'email',
        'password',
        'remember_token',
        'nombre_completo_razon_social',
        'idestatus',
        'idFabricante',
        'idgrupo_persona',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var list<string>
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'email_verified_at' => 'datetime',
            'password' => 'hashed',
        ];
    }

    public function getAuthIdentifierName()
    {
        return 'name';
    }

    public function getAuthIdentifier()
    {
        return $this->{$this->getAuthIdentifierName()};
    }

    public function getAuthPassword()
    {
        return $this->password;
    }

}
