<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CustomerReference extends Model
{
    use HasFactory, SoftDeletes;
    protected $table = "customer_references";
    protected $fillable  = [
        'id',
        'name',
        'relationship',
        'phone',
        'email',
        'company',
        'position',
        'comments',
        'code',
        'is_influencer',
        'referred_by_customer_id',
        'entity_status',
    ];

    protected $hidden = [
        'updated_at',
        'deleted_at',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    public function customers()
    {
        return $this->hasOne(Customer::class);
    }

    public function referred_by_customer()
    {
        return $this->belongsTo(Customer::class);
    }

    public function opportunities()
    {
        return $this->hasOne(Opportunity::class);
    }

}
