<?php

namespace App\Models;

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

class CompanyBinder extends Model
{
    use HasFactory;

    /**A BINDER BELONGS TO A PARTICULAR INSURANCE COMPANY**/
    public function insurer(){
        return $this->belongsTo(Insurer::class, 'ins_id', 'ins_id');
    }

    /**A BINDER BELONGS TO A PARTICULAR PRODUCT OF INSURANCE**/
    public function product(){
        return $this->belongsTo(Product::class, 'prod_id', 'prod_id');
    }

    /**A BINDER CAN BELONG TO A PARTICULAR COVERAGE OF INSURANCE**/
    public function coverage(){
        return $this->belongsTo(ProductCategory::class, 'category', 'id');
    }

    /**A BINDER CAN BELONG TO A PARTICULAR SUB-COVER OF INSURANCE**/
    public function subCover(){
        return $this->belongsTo(ProductSubCategory::class, 'sub_category', 'id');
    }

    /**A BINDER CAN BELONG TO A PARTICULAR MINI-COVER OF INSURANCE**/
    public function miniCover(){
        return $this->belongsTo(ProductMiniSubCategory::class, 'mini_category', 'id');
    }

    /**A BINDER IS CREATED BY A SINGLE USER IN THE SYSTEM**/
    public function user(){
        return $this->belongsTo(User::class, 'created_by', 'id');
    }

}
