<?php

namespace App\Controller;

use App\Request\UserPatientRequest;
use App\Services\MyDoctorService;
use App\Services\UserPatientService;
use Hyperf\Snowflake\IdGeneratorInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * 患者
 */
class UserPatientController extends AbstractController
{
    /**
     * 获取患者个人中心数据
     * @return ResponseInterface
     */
    public function getPatientCenter(): ResponseInterface
    {
        $UserPatientService = new UserPatientService();
        $data = $UserPatientService->getPatientCenter();
        return $this->response->json($data);
    }

    /**
     * 获取患者信息
     * @return ResponseInterface
     */
    public function getPatientCenterInfo(): ResponseInterface
    {
        $UserPatientService = new UserPatientService();
        $data = $UserPatientService->getPatientCenterInfo();
        return $this->response->json($data);
    }

    /**
     * 获取患者优惠卷列表
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getPatientCouponlist(): ResponseInterface
    {
        $request = $this->container->get(UserPatientRequest::class);
        $request->scene('getPatientCouponlist')->validateResolved();

        $UserPatientService = new UserPatientService();
        $data = $UserPatientService->getPatientCouponlist();
        return $this->response->json($data);
    }

    /**
     * 删除服务过患者的医生
     * 首页-个人中心
     * @return ResponseInterface
     */
    public function deletePatientDoctor(): ResponseInterface
    {
        $UserPatientService = new UserPatientService();
        $data = $UserPatientService->deletePatientDoctor();
        return $this->response->json($data);
    }

    /**
     * 获取购物车药品数据
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getShoppingCart(): ResponseInterface
    {
        $UserPatientService = new UserPatientService();
        $data = $UserPatientService->getShoppingCart();
        return $this->response->json($data);
    }

    /**
     * 修改购物车药品数据
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function putShoppingCart(): ResponseInterface
    {
        $request = $this->container->get(UserPatientRequest::class);
        $request->scene('putShoppingCart')->validateResolved();

        $UserPatientService = new UserPatientService();
        $data = $UserPatientService->putShoppingCart();
        return $this->response->json($data);
    }

}