<?php

namespace App\Controller;

use App\Request\UserPharmacistRequest;
use App\Services\UserPharmacistService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * 药师
 */
class UserPharmacistController extends AbstractController
{
    /**
     * 获取药师审核处方列表
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getPrescriptionList(): ResponseInterface
    {
        $request = $this->container->get(UserPharmacistRequest::class);
        $request->scene('getPrescriptionList')->validateResolved();

        $UserPharmacistService = new UserPharmacistService();
        $data = $UserPharmacistService->getPrescriptionList();
        return $this->response->json($data);
    }

    /**
     * 设置上下线
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function putOnOff(): ResponseInterface
    {
        $request = $this->container->get(UserPharmacistRequest::class);
        $request->scene('putOnOff')->validateResolved();

        $UserPharmacistService = new UserPharmacistService();
        $data = $UserPharmacistService->putOnOff();
        return $this->response->json($data);
    }

    /**
     * 获取处方详情
     * @return ResponseInterface
     */
    public function getPrescriptionInfo(): ResponseInterface
    {
        $UserPharmacistService = new UserPharmacistService();
        $data = $UserPharmacistService->getPrescriptionInfo();
        return $this->response->json($data);
    }

    /**
     * 审核处方
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function putPrescriptionVerify(): ResponseInterface
    {
        $request = $this->container->get(UserPharmacistRequest::class);
        $request->scene('putPrescriptionVerify')->validateResolved();

        $UserPharmacistService = new UserPharmacistService();
        $data = $UserPharmacistService->putPrescriptionVerify();
        return $this->response->json($data);
    }

    /**
     * 药师基本资料
     * @return ResponseInterface
     */
    public function getPharmacistInfo(): ResponseInterface
    {
        $UserPharmacistService = new UserPharmacistService();
        $data = $UserPharmacistService->getPharmacistInfo();
        return $this->response->json($data);
    }
}