<?php

namespace App\Cells;

use App\Cells\BaseCell;
use App\Models\DeviceModel;

class ProductCell extends BaseCell
{
	private $_deviceModel = null;
	final protected function getDeviceModel(): DeviceModel
	{
		return $this->_deviceModel = $this->_deviceModel ?: new DeviceModel();
	}

	public function virtual(array $viewDatas): string
	{
		$viewDatas['cellDatas'] = array();
		return view(
			'Views/cells/product/' . __FUNCTION__,
			['viewDatas' => $viewDatas]
		);
	}

	public function beremetal(array $viewDatas): string
	{
		$viewDatas['cellDatas'] = [];
		$viewDatas['cellDatas']['device'] = [];
		$viewDatas['cellDatas']['device']['categorys'] = ['server', 'cpu', 'memory', 'disk', 'nic', 'publicip', 'os'];
		$viewDatas['cellDatas']['device']['options'] = $this->getDeviceModel()->getOptions();
		return view(
			'Views/cells/product/' . __FUNCTION__,
			['viewDatas' => $viewDatas]
		);
	}

	public function beremetal_calulator(array $viewDatas): string
	{
		$viewDatas['cellDatas']                        = [];
		$viewDatas['cellDatas']['device']              = [];
		$viewDatas['cellDatas']['device']['categorys'] = ['server', 'cpu', 'memory', 'disk', 'nic', 'publicip', 'os'];
		$viewDatas['cellDatas']['device']['options']   = $this->getDeviceModel()->getOptions();

		return view(
			'Views/cells/product/' . __FUNCTION__,
			['viewDatas' => $viewDatas]
		);
	}
}
