<?php

namespace App\Controller;

use App\Request\PatientDoctorRequest;
use App\Services\PatientDoctorService;
use App\Services\UserDoctorService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * 患者端医生数据
 */
class PatientDoctorController extends AbstractController
{
    /**
     * 获取问诊医生列表
     * 专家问诊-公益问诊共用
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getInquiryDoctorList(): ResponseInterface
    {
        $request = $this->container->get(PatientDoctorRequest::class);
        $request->scene('getInquiryDoctorList')->validateResolved();

        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->getInquiryDoctorList();
        return $this->response->json($data);
    }

    /**
     * 获取问诊医生详情
     * @return ResponseInterface
     */
    public function getInquiryDoctorInfo(): ResponseInterface
    {
        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->getInquiryDoctorInfo();
        return $this->response->json($data);
    }

    /**
     * 医生详情简介-详情中的简介
     * @return ResponseInterface
     */
    public function getDoctorProfile(): ResponseInterface
    {
        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->getDoctorProfile();
        return $this->response->json($data);
    }

    /**
     * 检测是否可以接诊
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getDoctorInquiryCheck(): ResponseInterface
    {
        $request = $this->container->get(PatientDoctorRequest::class);
        $request->scene('getDoctorInquiryCheck')->validateResolved();

        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->getDoctorInquiryCheck();
        return $this->response->json($data);
    }

    /**
     * 获取我的问诊、关注医生列表
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getDoctorList(): ResponseInterface
    {
        $request = $this->container->get(PatientDoctorRequest::class);
        $request->scene('getDoctorList')->validateResolved();

        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->getDoctorList();
        return $this->response->json($data);
    }

    /**
     * 获取医生评价
     * @return ResponseInterface
     */
    public function getDoctorEvaluationList(): ResponseInterface
    {
        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->getDoctorEvaluationList();
        return $this->response->json($data);
    }

    /**
     * 新增关注医生
     * @return ResponseInterface
     */
    public function addDoctorFollow(): ResponseInterface
    {
        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->addDoctorFollow();
        return $this->response->json($data);
    }

    /**
     * 取消关注医生
     * @return ResponseInterface
     */
    public function deleteDoctorFollow(): ResponseInterface
    {
        $PatientDoctorService = new PatientDoctorService();
        $data = $PatientDoctorService->deleteDoctorFollow();
        return $this->response->json($data);
    }
}