<?php
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.

namespace Shopware\Plugins\ViisonPickwareMobile\Classes\ApiRequestCompatibility;

use Shopware\Plugins\ViisonPickwareCommon\Classes\ApiRequestCompatibility\Layer;

class Variants20190918 extends Layer
{
    /**
     * @inheritdoc
     */
    public function getVersion()
    {
        return '2019-09-18';
    }

    /**
     * Removes any 'stocktake' sort parameter from the request parameters.
     *
     * pre GET /api/variants
     */
    public function preIndexAction()
    {
        $sort = $this->request->getParam('sort');
        if ($sort === 'stocktake') {
            $this->request->setParam('sort', []);
        }
    }
}
