<?php

{{>licenseInfo}}

/**
 * NOTE: This class is auto generated by the openapi generator program.
 * https://github.com/openapitools/openapi-generator
 * Do not edit the class manually.
 * Extend this class with your controller. You can inject dependencies via class constructor,
 * @see https://github.com/PHP-DI/Slim-Bridge basic example.
 */
namespace {{apiPackage}};

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Slim\Exception\HttpNotImplementedException;

/**
 * {{classname}} Class Doc Comment
 *
 * @package {{apiPackage}}
 * @author  OpenAPI Generator team
 * @link    https://github.com/openapitools/openapi-generator
 */
abstract class {{classname}}
{
    {{#operations}}
    {{#operation}}
    /**
     * {{httpMethod}} {{operationId}}
     {{#summary}}
     * Summary: {{.}}
     {{/summary}}
     {{#notes}}
     * Notes: {{.}}
     {{/notes}}
     {{#hasProduces}}
     * Output-Formats: [{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}]
     {{/hasProduces}}
     *
     * @param ServerRequestInterface $request  Request
     * @param ResponseInterface      $response Response
     {{#hasPathParams}}
     {{#pathParams}}
     * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}}
     {{/pathParams}}
     {{/hasPathParams}}
     *
     * @return ResponseInterface
     * @throws HttpNotImplementedException to force implementation class to override this method
    {{#isDeprecated}}
     * @deprecated
    {{/isDeprecated}}
     */
    public function {{operationId}}(
        ServerRequestInterface $request,
        ResponseInterface $response{{#hasPathParams}},{{/hasPathParams}}
        {{#hasPathParams}}
        {{#pathParams}}
        {{{dataType}}} ${{paramName}}{{^-last}},{{/-last}}
        {{/pathParams}}
        {{/hasPathParams}}
    ): ResponseInterface {
        {{#hasHeaderParams}}
        $headers = $request->getHeaders();
        {{#headerParams}}
        ${{paramName}} = $request->hasHeader('{{baseName}}') ? $headers['{{baseName}}'] : null;
        {{/headerParams}}
        {{/hasHeaderParams}}
        {{#hasQueryParams}}
        $queryParams = $request->getQueryParams();
        {{#queryParams}}
        ${{paramName}} = (key_exists('{{baseName}}', $queryParams)) ? $queryParams['{{baseName}}'] : null;
        {{/queryParams}}
        {{/hasQueryParams}}
        {{#hasFormParams}}
        $body = $request->getParsedBody();
        {{#formParams}}
        {{^isFile}}
        ${{paramName}} = (isset($body['{{baseName}}'])) ? $body['{{baseName}}'] : null;
        {{/isFile}}
        {{#isFile}}
        {{#isMultipart}}
        ${{paramName}} = (key_exists('{{baseName}}', $request->getUploadedFiles())) ? $request->getUploadedFiles()['{{baseName}}'] : null;
        {{/isMultipart}}
        {{^isMultipart}}
        ${{paramName}} = (isset($body['{{baseName}}'])) ? $body['{{baseName}}'] : null;
        {{/isMultipart}}
        {{/isFile}}
        {{/formParams}}
        {{/hasFormParams}}
        {{#hasBodyParam}}
        $body = $request->getParsedBody();
        {{/hasBodyParam}}
        $message = "How about implementing {{nickname}} as a {{httpMethod}} method in {{apiPackage}}\{{userClassname}} class?";
        throw new HttpNotImplementedException($request, $message);
    }
    {{^-last}}

    {{/-last}}
    {{/operation}}
    {{/operations}}
}
