<?php

namespace Modules\PortalApi\Entities;

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

class PortalOwner extends Model
{
    protected $table = 'portal_owners';

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

    protected $hidden = ['password'];

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

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