<?php
// DeviceModel.php
// Copyright P.Kassel, M.Seliger, G.Trietsch, all Rights Reserved
namespace Docuform\Api\Client;use Docuform\Api\HttpRequestHandler;use Docuform\Api\Exception\ApiHttpNotFoundException;use Docuform\Api\UserType;use Psr\Http\Message\ServerRequestInterface;use Psr\Http\Message\ResponseInterface;use Docuform\Api\ApiScopes;class DeviceModel extends HttpRequestHandler{public function getAllowedUserTypes($request):array{return[UserType::USERTYPE_CUSTOMER,UserType::USERTYPE_DEALER,UserType::USERTYPE_ADMIN];}public function getRequiredScopes($request):array{return['allOf'=>[ApiScopes::bulk],'anyOf'=>[]];}public function handleRequest($request,& $response,$arguments):int{$result=404;if($request->getMethod()==='GET'){$model=Model::readAll($this->getContainer());if(empty($model)){throw new ApiHttpNotFoundException($request,"Not Found","Model not found");}Model::buildJsonResponse($response,$model,'model');$result=200;}return $result;}}