<?php
/**
 * Notifications plugin for Craft CMS 5.x
 *
 * Send notifications across a variety of delivery channels, including mail and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.
 *
 * @link      https://craft-pulse.com
 * @copyright Copyright (c) 2025 CraftPulse
 */

namespace craftpulse\notifications\models;

use Craft;
use craft\base\Model;

use yii\base\Event;

class Notification extends Model
{
    /**
     * The unique identifier for the notification.
     *
     * @var string
     */
    public $id;

    /**
     * @var Event
     */
    public $event = null;

    /**
     * Constructor
     *
     * @param mixed $config
     */
    public function __construct($config)
    {
        $config = ['event' => $config];
        parent::__construct($config);
    }

    /**
     * The via function determines which channels will be used to send the notification to.
     * Each channel consists of the name as the key and the receiver(s) as the value in
     * the format that the channel expects.
     *
     * return [
     *     'database' => Craft::$app->getUsers()->getUserByUsernameOrEmail('info@example.com'),
     *     'slack' => '<YOUR_SLACK_WEBHOOK_URL>',
     *     'mail' => 'info@example.com',
     * ];
     *
     * @return array
     */
    public function via(): array
    {
        return [];
    }
}
