<?php

declare(strict_types=1);

namespace App\Models\Property;

use App\Models\Model;
use App\Models\User;

class ReferralKey extends Model
{
    protected ?string $table = 'referral_keys';

    protected array $fillable = [
        'hashkey',
        'user_id',
        'key',
        'is_active',
        'created_by',
        'updated_by',
    ];

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

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }

    public function updater()
    {
        return $this->belongsTo(User::class, 'updated_by');
    }
}
