<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class NotificationCampaignRecipient extends Model
{
    protected $fillable = [
        'notification_campaign_id',
        'tenant_id',
        'customer_id',
        'tenant_name',
        'customer_name',
        'email',
        'phone',
        'email_status',
        'sms_status',
        'portal_alert_status',
        'whatsapp_status',
        'email_error',
        'sms_error',
        'whatsapp_error',
        'sent_at',
    ];

    protected function casts(): array
    {
        return [
            'sent_at' => 'datetime',
        ];
    }

    public function campaign(): BelongsTo
    {
        return $this->belongsTo(NotificationCampaign::class, 'notification_campaign_id');
    }

    public function tenant(): BelongsTo
    {
        return $this->belongsTo(Tenant::class);
    }

    public function customer(): BelongsTo
    {
        return $this->belongsTo(Customer::class);
    }
}
