package com.hepl.tunefortwo.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.hepl.tunefortwo.dto.LoginRequestDto;
import com.hepl.tunefortwo.service.AuthService;
import com.hepl.tunefortwo.utils.JwtUtils;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;

@Tag(name = "Authentication for admin", description = "")
//@SecurityRequirement(name = "Bearer Authentication")
@RestController
@RequestMapping("/v1/authentication")
@Slf4j
public class AuthController {

    private final JwtUtils jwtUtils;
	private final AuthService authService;
	
	public AuthController(JwtUtils jwtutils,AuthService authService) {
	    this.jwtUtils = jwtutils; 
	    this.authService = authService;
	}

	
	@PostMapping("/login")
	public ResponseEntity<?> authenticateUser(@Validated @RequestBody LoginRequestDto loginRequest)
			throws JsonProcessingException {
		
		
		
		
		return authService.autheticateUser(loginRequest);
	}
	// @GetMapping()
	// public ResponseEntity<?> getAllUsers(){
	// 	return authService.getAllUsers();
		
	// }

}
