<?php

namespace App\Models;

use App\Notifications\PasswordReset;
use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class MasterDealer extends Authenticatable
{
    use HasFactory, Notifiable;

//    protected $guarded = "master-master-dealer";
    protected $fillable = [
        'master_dealer_id',
        'company_name',
        'contact_person',
        'contact_number',
        'email',
        'state',
        'password',
        'total_license',
        'used_license',
        'status',
    ];


    protected $hidden = [
        'password',
    ];

    public function subDealers()
    {
        return $this->hasMany(SubDealer::class);
    }

    public function sendPasswordResetNotification($token): void
    {
        $token = $token.'-02';

        $this->notify(new PasswordReset($token));
    }
}
