<?php

namespace App\Controller;

use App\Request\DoctorAccountRequest;
use App\Request\UserDoctorRequest;
use App\Services\DoctorAccountService;
use App\Utils\PcreMatch;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * 医生账户
 */
class DoctorAccountController extends AbstractController
{
    /**
     * 获取我的账户数据
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getDoctorAccount(): ResponseInterface
    {
        $request = $this->container->get(DoctorAccountRequest::class);
        $request->scene('getDoctorAccount')->validateResolved();

        $DoctorAccountService = new DoctorAccountService();
        $data = $DoctorAccountService->getDoctorAccount();
        return $this->response->json($data);
    }

    /**
     * 获取我的账户日账单明细数据
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getDoctorAccountInfo(): ResponseInterface
    {
        $request = $this->container->get(DoctorAccountRequest::class);
        $request->scene('getDoctorAccountInfo')->validateResolved();

        $DoctorAccountService = new DoctorAccountService();
        $data = $DoctorAccountService->getDoctorAccountInfo();
        return $this->response->json($data);
    }

    /**
     * 获取提现数据
     * @return ResponseInterface
     */
    public function getDoctorWithdrawal(): ResponseInterface
    {
        $DoctorAccountService = new DoctorAccountService();
        $data = $DoctorAccountService->getDoctorWithdrawal();
        return $this->response->json($data);
    }

    /**
     * 获取可提现问诊订单列表
     * @return ResponseInterface
     */
    public function getDoctorWithdrawalOrderList(): ResponseInterface
    {
        $DoctorAccountService = new DoctorAccountService();
        $data = $DoctorAccountService->getDoctorWithdrawalOrderList();
        return $this->response->json($data);
    }

    /**
     * 获取医生提现记录列表
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getDoctorWithdrawalRecordList(): ResponseInterface
    {
        $request = $this->container->get(DoctorAccountRequest::class);
        $request->scene('getDoctorWithdrawalRecordList')->validateResolved();

        $DoctorAccountService = new DoctorAccountService();
        $data = $DoctorAccountService->getDoctorWithdrawalRecordList();
        return $this->response->json($data);
    }
}