<?php

namespace App\Models;

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

class NotificationTemplate extends Model
{
    public const EVENT_TYPES = ['pre_due', 'due', 'overdue'];
    public const CHANNELS = ['sms', 'whatsapp', 'email', 'in_system'];

    protected $fillable = ['business_id', 'event_type', 'channel', 'subject', 'body', 'active'];

    protected function casts(): array
    {
        return ['active' => 'boolean'];
    }

    public function business(): BelongsTo { return $this->belongsTo(Business::class); }
    public function logs(): HasMany { return $this->hasMany(ReminderNotificationLog::class); }
}
