<?php

namespace Modules\Bms\Entities;

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

class BmsMatchRun extends Model
{
    protected $table = 'bms_match_runs';

    protected $fillable = [
        'business_id', 'source', 'wizard_session_id', 'lead_id',
        'criteria', 'results', 'top_score', 'matched_count', 'created_by',
    ];

    protected $casts = [
        'criteria'      => 'array',
        'results'       => 'array',
        'top_score'     => 'integer',
        'matched_count' => 'integer',
    ];

    public function lead(): BelongsTo
    {
        return $this->belongsTo(BmsLead::class, 'lead_id');
    }

    public function wizardSession(): BelongsTo
    {
        return $this->belongsTo(BmsWizardSession::class, 'wizard_session_id');
    }
}
