<?php

namespace App\Models;

use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CorporateServiceSpeciality extends Model
{
    use HasFactory, SoftDeletes, Blameable;

    protected $fillable = [
        'corporate_service_id',
        'speciality_id',
        'active'
    ];
    
    protected $hidden = [
        'created_at',
        'updated_at',
        'deleted_at',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    public function corporateService()
    {
        return $this->belongsTo(CorporateService::class, 'corporate_service_id');
    }

    public function corporate()
    {
        return $this->hasOneThrough(Corporate::class, CorporateService::class);
    }

    public function speciality()
    {
        return $this->belongsTo(Speciality::class, 'speciality_id');
    }

    public function exclusions()
    {
        return $this->morphMany(Exclusion::class, 'exclusionable');
    }
}
