<?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 CompanyProfile extends Authenticatable
{
    use HasFactory, Notifiable;

    protected $fillable = [
        'company_id',
        'company_name',
        'contact_name',
        'contact_number',
        'roc',
        'address1',
        'address2',
        'address3',
        'address4',
        'state',
        'postcode',
        'geo_location',
        'email',
        'raw_password',
        'password',
    ];

    protected $hidden = [
        'password', 'raw_password','geo_location'
    ];

    public function app()
    {
        return $this->belongsTo(EzyPOS::class, 'company_id', 'company_id');
    }

    public function sendPasswordResetNotification($token): void
    {
        $token = $token.'-04';
        $this->notify(new PasswordReset($token));
    }
}
