<?php

namespace App\Models;

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

class PhoneResult extends Model
{
    use HasFactory;

    protected $fillable = [
        'upload_id',
        'tenant_id',
        'original',
        'e164',
        'local_format',
        'whatsapp_format',
        'dashed_format',
        'is_valid',
        'is_duplicate',
        'country_code',
        'country_name',
        'number_type',
        'risk_score',
        'whatsapp_likely',
        'duplicate_cluster_id',
    ];

    protected $casts = [
        'is_valid'       => 'boolean',
        'is_duplicate'   => 'boolean',
        'whatsapp_likely'=> 'boolean',
        'risk_score'     => 'integer',
    ];

    // ── Relations ──────────────────────────────────────────────────────────

    public function upload(): BelongsTo
    {
        return $this->belongsTo(Upload::class);
    }

    public function tenant(): BelongsTo
    {
        return $this->belongsTo(Tenant::class);
    }
}
