<?php

namespace App\Http\Controllers\Admin\Api\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\ForgotPasswordRequest;
use App\libs\Response\GlobalApiResponse;
use App\libs\Response\GlobalApiResponseCodeBook;
use App\Services\Admin\Auth\ForgotPasswordService;

class ForgotPasswordController extends Controller
{
    private $forgotPasswordService;

    public function __construct(ForgotPasswordService $forgotPasswordService)
    {
        $this->middleware('guest');
        $this->forgotPasswordService = $forgotPasswordService;
    }

    /**
     * Send a reset link to the given user.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
     */
    public function sendResetLinkEmail(ForgotPasswordRequest $forgotPasswordRequest)
    {
        $data = $this->forgotPasswordService->sendResetLinkEmail($forgotPasswordRequest);
        return $data;
    }
}
