<?php

/**
 * Lifestyle Webconsulting GmbH
 *
 * LICENSE: This Software is the property of Lifestyle Webconsulting GmbH (Aschaffenburg, Germany)
 * and is private by copyright law - it is NOT Freeware.
 *
 * Any unauthorized use of this software without a valid license
 * is a violation of the license agreement and will be prosecuted by
 * civil and criminal law.
 *
 * @copyright  2019 Lifestyle Webconsulting GmbH
 * @link       https://www.life-style.de
 */

namespace Sso\WebserviceBundle\Services\UserApplication\ShowDetails\Request\Version3;

use Sso\WebserviceBundle\Api\ApiManagerInterface;
use Sso\WebserviceBundle\Services\UserApplication\ShowDetails\RequestData\Factory as RequestDataFactory;
use Symfony\Component\Validator\Validator\ValidatorInterface;

/**
 * Class Factory
 *
 * @copyright  2016 Lifestyle Webconsulting GmbH
 * @link       http://www.life-style.de
 * @package Sso\WebserviceBundle\Services\UserApplication\ShowDetails\Request\Version3
 */
final class Factory
{
    /**
     * @var ApiManagerInterface
     */
    private $apiM;

    /**
     * @var RequestDataFactory;
     */
    private $requestDataFactory;

    /**
     * @var ValidatorInterface
     */
    private $validator;
    /**
     * @var \Sso\WebserviceBundle\ErrorHandler\Manager
     */
    private $errorHandler;

    /**
     * Factory constructor.
     * @param ApiManagerInterface $apiM
     * @param RequestDataFactory $requestDataFactory
     */
    public function __construct(ApiManagerInterface $apiM, RequestDataFactory $requestDataFactory)
    {
        $this->apiM = $apiM;
        $this->requestDataFactory = $requestDataFactory;
        $this->errorHandler = $this->apiM->errorHandler();
        $this->validator = $this->apiM->validator();
    }

    /**
     * @return RequestParser
     */
    public function requestParser()
    {
        return new RequestParser($this->apiM->serializer(), $this->requestDataFactory, $this->errorHandler, $this->validator);
    }
}
