<?php

namespace Benhauer\Salesmanago\Block\Adminhtml\Client;

use \Benhauer\Salesmanago\Helper\Metrix;

use \Magento\Backend\Block\Template\Context;
use \Magento\Backend\Block\Widget\Form\Generic;
use \Magento\Framework\Data\FormFactory;
use \Magento\Framework\Registry;
use \Magento\Store\Model\System\Store;

use \Benhauer\Salesmanago\Model\SM\Rest as SmModel;
use \Benhauer\Salesmanago\Helper\Config as PluginConfig;

class WelcomeForm extends Generic
{
    protected $_systemStore;
    protected $_metrix;

    public $PluginConfig;
    public $model;

    public $contactCount = 0;
    public $planType = '';
    public $versionType = '';
    public $pluginVersion = '1.0.0';

    public function __construct(
        Context $context,
        Registry $registry,
        FormFactory $formFactory,
        Store $systemStore,
        SmModel $model,
        Metrix $metrix,
        array $data = []
    ) {
        $this->_systemStore = $systemStore;
        $this->model = $model;
        $this->_metrix = $metrix;
        parent::__construct($context, $registry, $formFactory, $data);
    }

    /**
     * Init form
     *
     * @return void
     */
    protected function _construct() {
        parent::_construct();
        $this->setId('welcome_form');
        $this->setTitle(__('Welcome'));
        $this->getAccountTypeData();
    }

    public function getAccountTypeData()
    {
        $data = $this->model->getAccountType();

        $this->versionType = isset($data['versionType']) ? $data['versionType'] : '';
        $this->planType = isset($data['planType']) ? $data['planType'] : '';
        $this->contactCount = isset($data['contactCount']) ? $data['contactCount'] : '';
        $this->pluginVersion = PluginConfig::getPluginVersion();
    }

    public function addFilter(\Magento\Framework\Api\Filter $filter)
    {
        return null;
    }
}
