<?php

namespace Modules\Vrc\Entities;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class VrcPortalOwner extends Model
{
    protected $table = 'vrc_portal_owners';

    protected $fillable = [
        'business_id', 'erp_customer_id', 'name', 'phone', 'email', 'password',
        'otp_code', 'otp_expires_at', 'is_active', 'last_login_at',
    ];

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

    protected $casts = [
        'is_active'      => 'boolean',
        'otp_expires_at' => 'datetime',
        'last_login_at'  => 'datetime',
    ];

    public function tokens(): HasMany
    {
        return $this->hasMany(VrcPortalOwnerToken::class, 'owner_id');
    }
}
