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

    protected $table = 'trial_company_profiles';

    protected string $guard = 'trial-account';

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

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

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


    public function paymentMethods()
    {
        return $this->hasMany(TrialAccountPaymentMethod::class, 'trial_company_id', 'id');
    }


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