<?php

namespace App\Models;

use App\Models\Concerns\BelongsToBusiness;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Message extends Model
{
    use BelongsToBusiness, SoftDeletes;
    protected $guarded = ['id'];
    protected $casts = ['sent_at'=>'datetime','delivered_at'=>'datetime','read_at'=>'datetime','failed_at'=>'datetime','provider_metadata'=>'array'];
    public function related() { return $this->morphTo(); }
    public function files() { return $this->morphMany(CrmFile::class, 'fileable'); }
    public function assignments() { return $this->morphMany(CrmAssignment::class, 'assignable'); }
}
