<?php

namespace App\Domain\Notification\Models;

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

class NotificationPreference extends Model
{
    protected $table = 'notification_preferences';

    protected $fillable = [
        'user_id',
        'event_type',
        'channel_email',
        'channel_sms',
        'channel_in_app',
        'digest_mode',
        'digest_time',
    ];

    protected $casts = [
        'channel_email' => 'boolean',
        'channel_sms' => 'boolean',
        'channel_in_app' => 'boolean',
        'digest_mode' => 'boolean',
    ];

    // Relationships

    public function user(): BelongsTo
    {
        return $this->belongsTo(\App\Models\User::class);
    }
}
