<?php

namespace App\Controller;

use App\Request\SafeRequest;
use App\Services\SafeService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;

class SafeController extends AbstractController
{
    /**
     * 获取oss签名数据
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getOssSign(): ResponseInterface
    {
        $request = $this->container->get(SafeRequest::class);
        $request->scene('getOssSign')->validateResolved();

        $SafeService = new SafeService();
        $data = $SafeService->getOssSign();
        return $this->response->json($data);
    }

    /**
     * 获取im签名数据
     * @return ResponseInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getImSign(): ResponseInterface
    {
        $SafeService = new SafeService();
        $data = $SafeService->getImSign();
        return $this->response->json($data);
    }
}