<?php

namespace App\Services\NoticeService;

use App\Services\NoticeService\Channels\KfAccountChannel;
use App\Services\NoticeService\Channels\MiniTemplateChannel;
use App\Services\NoticeService\Channels\TemplateChannel;

class DemoNotification extends Notification
{

    protected $title = "";


    public function __construct($to_uid)
    {
        parent::__construct($to_uid);
    }


    /**
     * 是否订阅
     * @return bool
     */
    public function subscribe(): bool
    {
        return true;
    }


    /**
     * 节流阀
     * @return bool
     */
    public function throttle(): bool
    {
        return true;
    }


    /**
     * 通知渠道
     * @return array
     */
    public function via(): array
    {
        return [
            $this->toKfAccount(),
            $this->toTemplate(),
            $this->toMiniTemplate(),
        ];
    }


    /**
     * 客服通知
     * @return KfAccountChannel
     */
    public function toKfAccount()
    {
        $content = "";
        $channel = new KfAccountChannel($this->to_uid, $content);

        return $channel;
    }

    /**
     * 模版消息
     * @return TemplateChannel
     */
    public function toTemplate()
    {
        $templateId = "";
        $data = [];

        return new TemplateChannel($this->to_uid, $templateId, $data);
    }

    /**
     * 小程序模版消息
     * @return MiniTemplateChannel
     */
    public function toMiniTemplate()
    {
        $templateId = "";
        $data = [];

        return new MiniTemplateChannel($this->to_uid, $templateId, $data);
    }

    protected function getPagePath()
    {
        return parent::getPagePath();
    }
}
