<?php


namespace App\Libs\Push\HuaWei\Admin\Msg\WebPush;


class WebPushNotificationAction
{
    private $title;

    private $icon;

    private $action;

    private $fields;

    public function __construct()
    {
        $this->fields = array();
    }

    public function title($value)
    {
        $this->title = $value;
    }

    public function action($value)
    {
        $this->action = $value;
    }

    public function icon($value)
    {
        $this->icon = $value;
    }

    public function getFields()
    {
        return $this->fields;
    }

    public function buildFields()
    {
        $keys = array(
            'title',
            'icon',
            'action'
        );
        foreach ($keys as $key) {
            if (isset($this->$key)) {
                $this->fields[$key] = $this->$key;
            }
        }
    }
}