<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MessageCampaign extends Model
{
    protected $guarded = ['id'];
    protected $casts = ['audience' => 'array', 'sent_at' => 'datetime'];

    public function template()
    {
        return $this->belongsTo(MessageTemplate::class);
    }

    public function messages()
    {
        return $this->hasMany(CrmMessage::class, 'campaign_id');
    }
}
