<?php

namespace Modules\Admin\App\Models;

use Illuminate\Database\Eloquent\Model;

class ContactableItem extends Model
{
    protected $table = 'contactable_items';

    protected $fillable = [
        'contactable_id',
        'contactable_type',
        'type',
        'data_contact',
        'is_preferred',
        'preference_level',
    ];

    /**
     * Casts for the model attributes.
     */
    protected $casts = [
        'is_preferred' => 'boolean',
        'preference_level' => 'integer',
    ];

    /**
     * Polymorphic relationship to the parent model.
     */
    public function contactable()
    {
        return $this->morphTo();
    }
}
