<?php

namespace App\Classes\Modules\Accounts\ControllersLogic;

use App\Classes\Modules\Accounts\Processors\CrossAuthenticationProcessor;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class CrossAuthenticateUserLogic extends AbstractControllerLogic
{

    protected function notification():array {
        return [
            'title' => 'Cross Authentication',
            'message' => 'You have successfully logged in to your account'
        ];
    }

    /** @var CrossAuthenticationProcessor */
    private $crossAuthenticationProcessor;


    /**
     * CrossAuthenticateUserLogic constructor.
     * @param CrossAuthenticationProcessor $authenticationProcessor
     */
    public function __construct(CrossAuthenticationProcessor $crossAuthenticationProcessor)
    {
        $this->crossAuthenticationProcessor = $crossAuthenticationProcessor;
    }

    /**
     * @param Request $request
     * @return JsonResponse
     * @throws \App\Classes\Exceptions\AccessForbiddenException
     * @throws \App\Classes\Exceptions\AccessUnauthorisedException
     * @throws \App\Classes\Exceptions\RequestValidationException
     */
    protected function logic(Request $request): JsonResponse {
        return $this->response($this->crossAuthenticationProcessor->execute($request));
    }

}