<?php

namespace App\Http\Controllers\Dashboard;

use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\Request;
use App\Services\AuthService;

class AuthController extends Controller
{
    public function __construct(protected AuthService $service)
    {

    }

    public function login(LoginRequest $request)
    {
        $data = $this->service->loginAdmin($request->email, $request->password);
        return response()->json($data);
    }

    public function register(Request $request)
    {
        $registerData = $this->service->register($request->all());
        return response()->json($registerData);    
    }


    public function logout(Request $request)
    {
        $data = $this->service->logout();
        response()->json($data);
    }
}
